From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13C90C433B4 for ; Wed, 21 Apr 2021 09:37:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AF1996143D for ; Wed, 21 Apr 2021 09:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238277AbhDUJhq (ORCPT ); Wed, 21 Apr 2021 05:37:46 -0400 Received: from muru.com ([72.249.23.125]:57140 "EHLO muru.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238140AbhDUJhp (ORCPT ); Wed, 21 Apr 2021 05:37:45 -0400 Received: from atomide.com (localhost [127.0.0.1]) by muru.com (Postfix) with ESMTPS id 44E5780F7; Wed, 21 Apr 2021 09:38:33 +0000 (UTC) Date: Wed, 21 Apr 2021 12:37:07 +0300 From: Tony Lindgren To: Daniel Lezcano Cc: Greg KH , Lin Ruizhe , rui.zhang@intel.com, edubezval@gmail.com, j-keerthy@ti.com, amitk@kernel.org, radhesh.fadnis@ti.com, eballetbo@gmail.com, linux-pm@vger.kernel.org, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] thermal: ti-soc-thermal: Remove unused variable 'val' Message-ID: References: <20210421084256.57591-1-linruizhe@huawei.com> <8e66040e-4330-d4f0-afbb-8cae62a5082e@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8e66040e-4330-d4f0-afbb-8cae62a5082e@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org * Daniel Lezcano [210421 09:07]: > On 21/04/2021 10:49, Greg KH wrote: > > On Wed, Apr 21, 2021 at 04:42:56PM +0800, Lin Ruizhe wrote: > >> The variable 'val'in function ti_bandgap_restore_ctxt is > >> the register value of read bandgap registers. This function is to > >> restore the context. But there is no operation on the return value > >> of this register, so this block is redundant. Hulk robot scans this > >> warning.This commit remove the dead code. > >> > >> Reported-by: Hulk Robot > >> Fixes: b87ea759a4cc ("staging: omap-thermal: fix context restore function") > >> Signed-off-by: Lin Ruizhe > >> --- > >> v3: > >> -Add Fixes tag and more accurate commit message in this patch. > >> v2: > >> -As suggest remove the whole unuesed block in fuction > >> ti_bandgap_restore_ctxt > >> > >> drivers/thermal/ti-soc-thermal/ti-bandgap.c | 4 ---- > >> 1 file changed, 4 deletions(-) > >> > >> diff --git a/drivers/thermal/ti-soc-thermal/ti-bandgap.c b/drivers/thermal/ti-soc-thermal/ti-bandgap.c > >> index d81af89166d2..684ffb645aa9 100644 > >> --- a/drivers/thermal/ti-soc-thermal/ti-bandgap.c > >> +++ b/drivers/thermal/ti-soc-thermal/ti-bandgap.c > >> @@ -1142,14 +1142,10 @@ static int ti_bandgap_restore_ctxt(struct ti_bandgap *bgp) > >> for (i = 0; i < bgp->conf->sensor_count; i++) { > >> struct temp_sensor_registers *tsr; > >> struct temp_sensor_regval *rval; > >> - u32 val = 0; > >> > >> rval = &bgp->regval[i]; > >> tsr = bgp->conf->sensors[i].registers; > >> > >> - if (TI_BANDGAP_HAS(bgp, COUNTER)) > >> - val = ti_bandgap_readl(bgp, tsr->bgap_counter); > > > > Are you sure that this hardware does not require this read to happen in > > order for it to work properly? > > Yes, initially we had the same concern but we were unable to find > anything specific in the history. The commit mentioned above removed the > user of the 'val' code but without removing this block of code. > > When looking at the current code, it really looks like an oversight. Yes so it seems. > There is nothing in the commit's changelog referring to a need of > reading the counter register but perhaps I'm wrong because I'm not sure > to understand correctly the changelog. > > > Lots of hardware does need this, have you tested this? I just tested this on omap3 logicpd torpedo devkit that can do off during idle and reading /sys/class/thermal/thermal_zone0/temp works. So feel free to add: Reviewed-by: Tony Lindgren Tested-by: Tony Lindgren