From patchwork Mon Jul 31 07:23:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Louis Yu X-Patchwork-Id: 9871127 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5788660375 for ; Mon, 31 Jul 2017 07:24:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42025285AD for ; Mon, 31 Jul 2017 07:24:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 36BAB285AA; Mon, 31 Jul 2017 07:24:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A5E86285B6 for ; Mon, 31 Jul 2017 07:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:To:From:Subject:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=q/8vtj4mD2FH7xounpd1DuUHsK/gh6oAzN/PDYWnBIg=; b=ff8b6Fgh2sydU1 ZSuW0pR5ObmpXWxjr8AfLcHM/3oeFscHdvVJRp06fdsAfh5M5PydcLqYpojJUwTKPbm2M0yKOmrPb 3U2S7Ns/Wkc3zHNO1/Xv5SMAaUMmQQr1ryWG1Du1RyATFLncQHP6/Q2sayg+NP+cHG4kNFh/fSt/g R/4VuOg1gNn5n6ybjCutD1iRJWr7zGYIVZMav3vJYL7MuAo0vs0rrL4CHavbPYsHcSYkNjYEZ8agB OWzZRH/GPyn2z5+I+V/M/xCJWMZrVV1apRlJ0rhdML8rZ7Kr26nYFol/oJ5X74sWQNqWsemW1vBzk 8zK/vjV5L4JKBKape7Fg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dc53Z-0004Rb-D3; Mon, 31 Jul 2017 07:24:01 +0000 Received: from [210.61.82.183] (helo=mailgw01.mediatek.com) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dc53X-00042k-1s for linux-mediatek@lists.infradead.org; Mon, 31 Jul 2017 07:24:00 +0000 Received: from mtkcas08.mediatek.inc [(172.21.101.126)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1408595807; Mon, 31 Jul 2017 15:23:33 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs08n1.mediatek.inc (172.21.101.55) with Microsoft SMTP Server (TLS) id 15.0.1210.3; Mon, 31 Jul 2017 15:23:31 +0800 Received: from [172.21.77.4] (172.21.77.4) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1210.3 via Frontend Transport; Mon, 31 Jul 2017 15:23:31 +0800 Message-ID: <1501485811.9219.34.camel@mtksdaap41> Subject: Re: [PATCH v1 4/4] thermal: mediatek: minor mtk_thermal.c cleanups From: Louis Yu To: Matthias Brugger Date: Mon, 31 Jul 2017 15:23:31 +0800 In-Reply-To: References: <1501134417-3505-1-git-send-email-louis.yu@mediatek.com> <1501134417-3505-5-git-send-email-louis.yu@mediatek.com> X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170731_002359_270566_55848862 X-CRM114-Status: GOOD ( 17.66 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , srv_heupstream@mediatek.com, linux-pm@vger.kernel.org, dawei.chien@mediatek.com, Eduardo Valentin , fan.chen@mediatek.com, Rob Herring , linux-mediatek@lists.infradead.org, Zhang Rui , eddie.huang@mediatek.com Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Matthias, On Thu, 2017-07-27 at 17:49 +0200, Matthias Brugger wrote: > > On 07/27/2017 07:46 AM, louis.yu@mediatek.com wrote: > > From: Louis Yu > > > > Move thermal module reset in the beginning and revise clock error > > handle flow to pair the clock control. > > > > Signed-off-by: Louis Yu > > --- > > drivers/thermal/mtk_thermal.c | 12 ++++++------ > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c > > index f2a7155..5dffdb4 100644 > > --- a/drivers/thermal/mtk_thermal.c > > +++ b/drivers/thermal/mtk_thermal.c > > @@ -712,20 +712,20 @@ static int mtk_thermal_probe(struct platform_device *pdev) > > return -EINVAL; > > } > > > > + ret = device_reset(&pdev->dev); > > + if (ret) > > + return ret; > > + > > ret = clk_prepare_enable(mt->clk_auxadc); > > if (ret) { > > dev_err(&pdev->dev, "Can't enable auxadc clk: %d\n", ret); > > - return ret; > > - } > > - > > - ret = device_reset(&pdev->dev); > > - if (ret) > > goto err_disable_clk_auxadc; > > + } > > > > ret = clk_prepare_enable(mt->clk_peri_therm); > > if (ret) { > > dev_err(&pdev->dev, "Can't enable peri clk: %d\n", ret); > > - goto err_disable_clk_auxadc; > > + goto err_disable_clk_peri_therm; > > If you can't enable the clock, there is no use in disable it in the error path. > > Regards, > Matthias > Thanks for your reminder.This is no use to disable it in the error path. I would update this in next version as follows. for (i = 0; i < mt->conf->num_banks; i++) Regards Louis > > } > > > > for (i = 0; i < mt->conf->num_banks; i++) > > diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c index 5dffdb4..3df0de3 100644 --- a/drivers/thermal/mtk_thermal.c +++ b/drivers/thermal/mtk_thermal.c @@ -719,13 +719,13 @@ static int mtk_thermal_probe(struct platform_device *pdev) ret = clk_prepare_enable(mt->clk_auxadc); if (ret) { dev_err(&pdev->dev, "Can't enable auxadc clk: %d\n", ret); - goto err_disable_clk_auxadc; + return ret; } ret = clk_prepare_enable(mt->clk_peri_therm); if (ret) { dev_err(&pdev->dev, "Can't enable peri clk: %d\n", ret); - goto err_disable_clk_peri_therm; + goto err_disable_clk_auxadc; }