Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp25095imm; Tue, 17 Jul 2018 13:12:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeDbFfU3m9s9CE1afnUxerHSyOFoCYGGm7ETD5LxkF7KuBfnBPOyDwZQuDeCui8/4o4jQ90 X-Received: by 2002:a62:2352:: with SMTP id j79-v6mr2068876pfj.221.1531858379301; Tue, 17 Jul 2018 13:12:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531858379; cv=none; d=google.com; s=arc-20160816; b=U+mX2FuV7rwIT16jS1zzxjJ1UH4pSVxuElyzkJpOUzwiFlAx/kh1jqrNbrvhr1lQmf l34BDMiWhV8fJjRH2IDcjGP4dvxYocb209YOp2YyPMg099L6ZOkj01OrP19t6GaVXU7f q3aq9rxO6XLQXPgXwtXaUWkkYfeVw5cwe77VhmxbfnrzV7ud92eteNRB0mMb5m9CGmyO cPaIF6YWwJnGlzGV9GZMzL/4koPRGm7EKpFulAt+16tXSks1Unjg0n2QXd04v6UvgMHK yWLsaaNkCx58fA5sTw3EBCLf01Q6pTbkwX7DQDTWezCK5ndRRioT5kuhxFGiwvM740DZ DbdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=nZ4bpx1zafbr5titW32CKnauJ8pLOsXJssKSMQXbWkw=; b=BQLXY5XosUZ7UoysVHgsMSyB8Vbn1QJSKIu3+62WB2LnifSjzV1WwTBZJx4qHLxy5t 6zQDUghKexzq9Z8zmGh0q4PcucgJEpxvm2e8xR3u0FNS5qZoDiRSY8Io4tXE1KNBSJze IVMytfyHLOEffq7S7FU/eaU/t9HbUbAqcgFDP5pvhaGAFN4zVSBiDa7DXkhh98eM7vmJ B403TsDtcQdcRi0SMNucjoP0KD2ROMkTFXwHKOqWUwCQpHKXkYHaytVCbnXmsNy+qnrH RdGz6zzQE/fB6bfRvmzQgcETnY/l3zpmK7GNYpAv3Vl3grYq1usdA3bCBVrJCNw1eozP TKZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TMJg59lg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s82-v6si1604887pfj.338.2018.07.17.13.12.39; Tue, 17 Jul 2018 13:12:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TMJg59lg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730839AbeGQUpk (ORCPT + 99 others); Tue, 17 Jul 2018 16:45:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:56612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729719AbeGQUpj (ORCPT ); Tue, 17 Jul 2018 16:45:39 -0400 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9C3232077B; Tue, 17 Jul 2018 20:11:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531858283; bh=zKangRooFhFponScmm40X4My+M9UfbwHkhuX8RqnllQ=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=TMJg59lg+s6HSNodsPL2WlEcAguqmDZ9gnX3lGw+Jhd+5PA3f+0KW2YbVbY3VN0nt baUH4EV6JeY4JHey3aftsfsJFfaY6Oh36W2GsudQ18Bcukn7IVxlmf0W6TvJq9CmnR 1UzsLs/BDBNPhoGCPtpPL0dScjMOqf6AjMwh3QJI= Received: by mail-wr1-f45.google.com with SMTP id q10-v6so2430129wrd.4; Tue, 17 Jul 2018 13:11:23 -0700 (PDT) X-Gm-Message-State: AOUpUlFWq2yRpaXJKFW85sHAGdmyxdzrQTlZB+0AwaUb3Aet3NaPWuFa X9k6vSfOvIJABx2xopNOGEDJ8gLigba+JiCdiAk= X-Received: by 2002:a5d:4452:: with SMTP id x18-v6mr2480043wrr.227.1531858282151; Tue, 17 Jul 2018 13:11:22 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:adf:9141:0:0:0:0:0 with HTTP; Tue, 17 Jul 2018 13:11:21 -0700 (PDT) In-Reply-To: References: <1531822342-4293-1-git-send-email-linux.amoon@gmail.com> <1531822342-4293-2-git-send-email-linux.amoon@gmail.com> From: Krzysztof Kozlowski Date: Tue, 17 Jul 2018 22:11:21 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/5] thermal: exynos: cleanup of clk err check for exynos_tmu_work To: Anand Moon Cc: Bartlomiej Zolnierkiewicz , Zhang Rui , Eduardo Valentin , Kukjin Kim , Rob Herring , Mark Rutland , Linux PM list , "linux-samsung-soc@vger.kernel.org" , linux-arm-kernel , Linux Kernel , devicetree Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 17 July 2018 at 22:08, Anand Moon wrote: > Hi Krzysztof, > > On 17 July 2018 at 17:54, Krzysztof Kozlowski wrote: >> On 17 July 2018 at 12:12, Anand Moon wrote: >>> cleanup err check in exynos_tmu_work as clk internal >>> framework will perform if clk is enable/disable >>> so drop the double check of IS_ERR and other such references. >> >> I do not understand the statement. Clock framework will perform if clk >> is enable/disable? How clock can be "enable" or "disable"? You mean >> gate clock? you mean clock pointer is an ERR pointer? >> > > if (!IS_ERR(data->clk_sec)) > check if the pointer is valid or not > this check is again performed in > clk_enable. This should be then written in commit msg. >>> CC: Bartlomiej Zolnierkiewicz >>> Signed-off-by: Anand Moon >>> --- >>> drivers/thermal/samsung/exynos_tmu.c | 19 ++++++------------- >>> 1 file changed, 6 insertions(+), 13 deletions(-) >>> >>> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c >>> index 0164c9e..2dbde97 100644 >>> --- a/drivers/thermal/samsung/exynos_tmu.c >>> +++ b/drivers/thermal/samsung/exynos_tmu.c >>> @@ -300,8 +300,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) >>> >>> mutex_lock(&data->lock); >>> clk_enable(data->clk); >>> - if (!IS_ERR(data->clk_sec)) >>> - clk_enable(data->clk_sec); >>> + clk_enable(data->clk_sec); >>> >>> status = readb(data->base + EXYNOS_TMU_REG_STATUS); >>> if (!status) { >>> @@ -334,8 +333,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev) >>> err: >>> clk_disable(data->clk); >>> mutex_unlock(&data->lock); >>> - if (!IS_ERR(data->clk_sec)) >>> - clk_disable(data->clk_sec); >>> + clk_disable(data->clk_sec); >>> out: >>> return ret; >>> } >>> @@ -789,19 +787,16 @@ static void exynos_tmu_work(struct work_struct *work) >>> struct exynos_tmu_data *data = container_of(work, >>> struct exynos_tmu_data, irq_work); >>> >>> - if (!IS_ERR(data->clk_sec)) >>> - clk_enable(data->clk_sec); >>> - if (!IS_ERR(data->clk_sec)) >>> - clk_disable(data->clk_sec); >>> - >>> thermal_zone_device_update(data->tzd, THERMAL_EVENT_UNSPECIFIED); >>> >>> mutex_lock(&data->lock); >>> clk_enable(data->clk); >>> + clk_enable(data->clk_sec); >> >> You are changing here the logic completely. Before the "enable" was >> followed immediately by "disable". Now you are moving disable >> somewhere else... All this looks suspicious... > > I chose to move enable/disable of clk_sec this under the mutex lock for safe > which dose the same sequence with different order. > > Second approach: > We should get rid of clk_enable/disable in exynos_tmu_work > as this looks unnecessary for toggle clk's on every update. I already sent a cleanup for this: https://patchwork.kernel.org/patch/10529971/ Best regards, Krzysztof