thermal: ti-soc-thermal: Remove unused variable 'val'
Subsystems (2)
PATCH v3 1/1 thermal: ti-soc-thermal: Remove unused variable 'val'
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.
---
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(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +0 -4
@@ -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); -if (TI_BANDGAP_HAS (bgp,TSHUT_CONFIG ))ti_bandgap_writel (bgp, rval->tshut_threshold, tsr->tshut_threshold);
Signature · 1 line
2.22.0
Quoted 24 lines · Lin Ruizhe
The variable 'val'in function
ti_bandgap_restore_ctxtis 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 <[email protected]>Fixes b87ea759a4cc ("staging: omap-thermal: fix context restore function")Signed-off-by Lin Ruizhe <[email protected]>---
v3:
-Add Fixes tag and more accurate commit message in this patch. v2:(quoted diff) +0
-1-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(-)drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-0
drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_restore_ctxt(struct ti_bandgap *bgp) · line 1151
Quoted 10 lines
drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-3@@ -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?
Lots of hardware does need this, have you tested this?
thanks,
greg k-h
Quoted 30 lines · Greg KH
Quoted 29 lines · Lin Ruizhe
The variable 'val'in function
ti_bandgap_restore_ctxtis 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 <[email protected]>Fixes b87ea759a4cc ("staging: omap-thermal: fix context restore function")Signed-off-by Lin Ruizhe <[email protected]>---
v3:
-Add Fixes tag and more accurate commit message in this patch. v2:(quoted diff) +0
-1-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(-)drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-1@@ -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 ;
Quoted 8 lines
drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_restore_ctxt(struct ti_bandgap *bgp) · line 1151
Quoted 5 lines
drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-2rval = &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.
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.
Quoted 6 lines
Lots of hardware does need this, have you tested this?
thanks,
greg k-h
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Quoted 40 lines · Daniel Lezcano
Quoted 30 lines · Greg KH
Quoted 29 lines · Lin Ruizhe
The variable 'val'in function
ti_bandgap_restore_ctxtis 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 <[email protected]>Fixes b87ea759a4cc ("staging: omap-thermal: fix context restore function")Signed-off-by Lin Ruizhe <[email protected]>---
v3:
-Add Fixes tag and more accurate commit message in this patch. v2:(quoted diff) +0
-1-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(-)drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-1@@ -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 ;Quoted 8 lines
drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_restore_ctxt(struct ti_bandgap *bgp) · line 1151
Quoted 5 lines
drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-2rval = &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?
Quoted 5 lines
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.
Quoted 5 lines
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.
Quoted 1 line
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:
Hi Tony,
thanks for testing
-- Daniel
Quoted 53 lines · Tony Lindgren
Quoted 40 lines · Daniel Lezcano
Quoted 30 lines · Greg KH
Quoted 29 lines · Lin Ruizhe
The variable 'val'in function
ti_bandgap_restore_ctxtis 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 <[email protected]>Fixes b87ea759a4cc ("staging: omap-thermal: fix context restore function")Signed-off-by Lin Ruizhe <[email protected]>---
v3:
-Add Fixes tag and more accurate commit message in this patch. v2:(quoted diff) +0
-1-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(-)drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-1@@ -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 ;Quoted 8 lines
drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_restore_ctxt(struct ti_bandgap *bgp) · line 1151
Quoted 5 lines
drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-2rval = &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?
Quoted 5 lines
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.
Quoted 4 lines
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.
Quoted 8 lines
Quoted 1 line
Quoted 1 line
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/tempworks. So feel free to add:Reviewed-by Tony Lindgren <[email protected]>Tested-by Tony Lindgren <[email protected]>
Thanks for testing
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Hi Daniel,
Do I need to make more changes to this patch?
Thanks
-Lin Ruizhe
-----邮件原件-----
发件人: Daniel Lezcano [mailto:[email protected]]
发送时间: 2021年4月21日 19:37
收件人: Tony Lindgren <[email protected]>
抄送: Greg KH <[email protected]>; linruizhe <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected] 主题: Re: [PATCH v3] thermal: ti-soc-thermal: Remove unused variable 'val'
Hi Tony,
thanks for testing
-- Daniel
Quoted 55 lines · Tony Lindgren
Quoted 42 lines · Daniel Lezcano
Quoted 32 lines · Greg KH
Quoted 31 lines · Lin Ruizhe
The variable 'val'in function
ti_bandgap_restore_ctxtis 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 <[email protected]>Fixes b87ea759a4cc ("staging: omap-thermal: fix context restorefunction")
Signed-off-by Lin Ruizhe <[email protected]>---
v3:
-Add Fixes tag and more accurate commit message in this patch. v2:
-As suggest remove the whole unuesed block in fuctionti_bandgap_restore_ctxtdrivers/thermal/ti-soc-thermal/ti-bandgap.c | 4 ---- 1 file changed, 4 deletions(-)drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-1@@ -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 ;Quoted 8 lines
drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_restore_ctxt(struct ti_bandgap *bgp) · line 1151
Quoted 5 lines
drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-2rval = &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?
Quoted 5 lines
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.
Quoted 4 lines
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.
Quoted 8 lines
Quoted 1 line
Quoted 1 line
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/tempworks. So feel free to add:Reviewed-by Tony Lindgren <[email protected]>Tested-by Tony Lindgren <[email protected]>
Thanks for testing
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Hi Lin,
Quoted 3 lines · linruizhe
Hi Daniel,
Do I need to make more changes to this patch?
No, it is fine. I've applied it.
Thanks
-- Daniel
Quoted 91 lines
Thanks
-Lin Ruizhe
-----邮件原件-----
发件人: Daniel Lezcano [mailto:[email protected]]
发送时间: 2021年4月21日 19:37
收件人: Tony Lindgren <[email protected]>
抄送: Greg KH <[email protected]>; linruizhe <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected] 主题: Re: [PATCH v3] thermal: ti-soc-thermal: Remove unused variable 'val'Hi Tony,
thanks for testing
-- Daniel
Quoted 55 lines · Tony Lindgren
Quoted 42 lines · Daniel Lezcano
Quoted 32 lines · Greg KH
Quoted 31 lines · Lin Ruizhe
The variable 'val'in function
ti_bandgap_restore_ctxtis 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 <[email protected]>Fixes b87ea759a4cc ("staging: omap-thermal: fix context restorefunction")
Signed-off-by Lin Ruizhe <[email protected]>---
v3:
-Add Fixes tag and more accurate commit message in this patch. v2:
-As suggest remove the whole unuesed block in fuctionti_bandgap_restore_ctxtdrivers/thermal/ti-soc-thermal/ti-bandgap.c | 4 ---- 1 file changed, 4 deletions(-)drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-1@@ -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 ;Quoted 8 lines
drivers/thermal/ti-soc-thermal/ti-bandgap.c static int ti_bandgap_restore_ctxt(struct ti_bandgap *bgp) · line 1151
Quoted 5 lines
drivers/thermal/ti-soc-thermal/ti-bandgap.c +0
-2rval = &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?
Quoted 5 lines
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.
Quoted 4 lines
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.
Quoted 8 lines
Quoted 1 line
Quoted 1 line
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/tempworks. So feel free to add:Reviewed-by Tony Lindgren <[email protected]>Tested-by Tony Lindgren <[email protected]>Thanks for testing
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCsFollow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
[thermal: thermal/next] thermal/drivers/ti-soc-thermal/bandgap Remove unused variable 'val'
In reply to Lin RuizheThe following commit has been merged into the thermal/next branch of thermal:
The following commit has been merged into the thermal/next branch of thermal:
Commit-ID: d473327f8f53418691cb2944a45da3e9ea51f9bf Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//d473327f8f53418691cb2944a45da3e9ea51f9bf Author: Lin Ruizhe <[email protected]> AuthorDate: Wed, 21 Apr 2021 16:42:56 +08:00 Committer: Daniel Lezcano <[email protected]> CommitterDate: Wed, 21 Apr 2021 13:37:18 +02:00
thermal/drivers/ti-soc-thermal/bandgap Remove unused variable 'val'
The function ti_bandgap_restore_ctxt() restores the context at resume time. It checks if the sensor has a counter, reads the register but does nothing with the value.
The block was probably omitted by the commit b87ea759a4cc.
Remove the unused variable as well as the block using it as we can consider it as dead code.
--- drivers/thermal/ti-soc-thermal/ti-bandgap.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/thermal/ti-soc-thermal/ti-bandgap.c +0 -4
@@ -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); -if (TI_BANDGAP_HAS (bgp,TSHUT_CONFIG ))ti_bandgap_writel (bgp, rval->tshut_threshold, tsr->tshut_threshold);