Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3465094imm; Tue, 17 Jul 2018 05:25:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf+yddGvqf939pP9ZwJxpulnB2PpJKD1DFgIVfjUmCggTdF6F/wj3dVY1FLnjjflM8Dvqmy X-Received: by 2002:a63:f953:: with SMTP id q19-v6mr1373496pgk.292.1531830324230; Tue, 17 Jul 2018 05:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531830324; cv=none; d=google.com; s=arc-20160816; b=WUnP9nGXnIzAbLKGg6F8bZ7RXk3VLvw7yZVhk0f8giqngSOtwqJv42s2tLU/6glsd7 +Mm34JVbaGp2hyvi1zHvTZtRzTl0IQaPHpDhgLmMeJzmN1Cnlc3Gi2xW7iWpRusSS4cr gNpqQBZUAVV5FbKFjvOgmBeW1/RwSDYod42habKd3elBKGAcb3zAivQqXLk7MXIS3OFI nReU3y2oUyRqRlmZgY/7lUil9ydgtuzjAPE+FlCIapeHXwR4QTSFPpaHfiY24K5+RWvH ++HJip2Oy3g9RTnPNVgGxDddb2t9XgJhyKl7xn+swnOblBOreT1xKL/e5k6z0aGZG1Fi Eh7w== 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=giCoELc4NN4oeQSpZsXyNdW1eudJ89OJQZPzy2PwOHM=; b=xhhkR+S9rbSiD/4n0TLkyEdme1h1pq4iOojN6SfPw98vZLd2HskuFkjzWO+5uaCskg 02xOQeF/0lqcxlguPuueIGXYIKRxyzSRbtTk2ICId/kTRM5iYilv4B+UrZ0vlbAhz6ch ik/xcRVYdP61R+OzSWNJgBxlWeSBC121yRkwifobASSRGtqu1g7cc+J26BmVcWL8OMnI CaBf7i7/7/YTy+sSMHdiR4wvD+5gMKIDTd0C1gmGDQqXTIAeamaRmcfjGzl/w+u5lrfo bd0l3jmGiXyAfEhdLp2Wnp+TRaEsvdoGMUnaX4L+/EbnDhQxOf8dD70Z84Fk1nFsQT6W qPsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=i9BIC5Ua; 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 k19-v6si821606pgi.494.2018.07.17.05.25.09; Tue, 17 Jul 2018 05:25:24 -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=i9BIC5Ua; 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 S1731446AbeGQM4w (ORCPT + 99 others); Tue, 17 Jul 2018 08:56:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:38344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728489AbeGQM4w (ORCPT ); Tue, 17 Jul 2018 08:56:52 -0400 Received: from mail-wm0-f42.google.com (mail-wm0-f42.google.com [74.125.82.42]) (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 ABAF821475; Tue, 17 Jul 2018 12:24:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1531830267; bh=qcgKRUTRMpob4NE2bZpCv7wds/SX8FRk7qgV6LcpriU=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=i9BIC5UawoxNTAofWsHVRTXwXAjQfaKKKTSaI7YWjHB8hOXDdLu2xMXjMMxw/0eTc Bd8mNBKnx3vWnkzLDVR/gcLG32QpDi70QG7me/KxAMmi8Pgm5Qsv5zIMUuiTDmpjvI bOv6pMiTUaL1ADdJVNeY1jzoiGca94+oNllvesh0= Received: by mail-wm0-f42.google.com with SMTP id s13-v6so12430824wmc.1; Tue, 17 Jul 2018 05:24:26 -0700 (PDT) X-Gm-Message-State: AOUpUlEH2qxEUizL08w1mhgoSCNq3hyyLqpw4x3inSDE1mxD21UYcfRz 4h/GnpGFRcPzUHIDZ5GwG0mAHX21zJ5BlMkZLa0= X-Received: by 2002:a1c:588d:: with SMTP id m135-v6mr1187212wmb.118.1531830265148; Tue, 17 Jul 2018 05:24:25 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:adf:9141:0:0:0:0:0 with HTTP; Tue, 17 Jul 2018 05:24:24 -0700 (PDT) In-Reply-To: <1531822342-4293-2-git-send-email-linux.amoon@gmail.com> 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 14:24:24 +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@vger.kernel.org, "linux-samsung-soc@vger.kernel.org" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org 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 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? > 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... Best regards, Krzysztof > > /* TODO: take action based on particular interrupt */ > data->tmu_clear_irqs(data); > > + clk_disable(data->clk_sec); > clk_disable(data->clk); > mutex_unlock(&data->lock); > enable_irq(data->irq); > @@ -1134,8 +1129,7 @@ static int exynos_tmu_probe(struct platform_device *pdev) > err_sclk: > clk_disable_unprepare(data->sclk); > err_clk_sec: > - if (!IS_ERR(data->clk_sec)) > - clk_disable_unprepare(data->clk_sec); > + clk_disable_unprepare(data->clk_sec); > err_clk: > clk_disable_unprepare(data->clk); > err_sensor: > @@ -1155,8 +1149,7 @@ static int exynos_tmu_remove(struct platform_device *pdev) > > clk_disable_unprepare(data->sclk); > clk_disable_unprepare(data->clk); > - if (!IS_ERR(data->clk_sec)) > - clk_disable_unprepare(data->clk_sec); > + clk_disable_unprepare(data->clk_sec); > > if (!IS_ERR(data->regulator)) > regulator_disable(data->regulator); > -- > 2.7.4 >