All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/3] thermal: armada_thermal: Replace mdelay with usleep_range in armada380_init_sensor
@ 2018-04-10  8:13 Jia-Ju Bai
  2018-04-27  2:13 ` Eduardo Valentin
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2018-04-10  8:13 UTC (permalink / raw)
  To: rui.zhang, edubezval; +Cc: linux-pm, linux-kernel, Jia-Ju Bai

armada380_init_sensor() is never called in atomic context.

armada380_init_sensor() is set as ".init_sensor" in
struct armada_thermal_data.
".init_sensor" is called armada_thermal_probe().
armada_thermal_probe() is set as ".probe" in struct platform_driver.
This function is not called in atomic context.

Despite never getting called from atomic context, armada380_init_sensor()
calls mdelay() to busily wait.
This is not necessary and can be replaced with usleep_range() to
avoid busy waiting.

This is found by a static analysis tool named DCNS written by myself.
And I also manually check it.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/thermal/armada_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
index ae75328..c289ae4 100644
--- a/drivers/thermal/armada_thermal.c
+++ b/drivers/thermal/armada_thermal.c
@@ -143,7 +143,7 @@ static void armada380_init_sensor(struct platform_device *pdev,
 	if (!(reg & A380_HW_RESET)) {
 		reg |= A380_HW_RESET;
 		writel(reg, priv->control);
-		mdelay(10);
+		usleep_range(10000, 11000);
 	}
 }
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 3/3] thermal: armada_thermal: Replace mdelay with usleep_range in armada380_init_sensor
  2018-04-10  8:13 [PATCH 3/3] thermal: armada_thermal: Replace mdelay with usleep_range in armada380_init_sensor Jia-Ju Bai
@ 2018-04-27  2:13 ` Eduardo Valentin
  0 siblings, 0 replies; 2+ messages in thread
From: Eduardo Valentin @ 2018-04-27  2:13 UTC (permalink / raw)
  To: Jia-Ju Bai; +Cc: rui.zhang, linux-pm, linux-kernel

On Tue, Apr 10, 2018 at 04:13:28PM +0800, Jia-Ju Bai wrote:
> armada380_init_sensor() is never called in atomic context.
> 
> armada380_init_sensor() is set as ".init_sensor" in
> struct armada_thermal_data.
> ".init_sensor" is called armada_thermal_probe().
> armada_thermal_probe() is set as ".probe" in struct platform_driver.
> This function is not called in atomic context.
> 
> Despite never getting called from atomic context, armada380_init_sensor()
> calls mdelay() to busily wait.
> This is not necessary and can be replaced with usleep_range() to
> avoid busy waiting.
> 
> This is found by a static analysis tool named DCNS written by myself.
> And I also manually check it.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
> ---
>  drivers/thermal/armada_thermal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/armada_thermal.c b/drivers/thermal/armada_thermal.c
> index ae75328..c289ae4 100644
> --- a/drivers/thermal/armada_thermal.c
> +++ b/drivers/thermal/armada_thermal.c
> @@ -143,7 +143,7 @@ static void armada380_init_sensor(struct platform_device *pdev,
>  	if (!(reg & A380_HW_RESET)) {
>  		reg |= A380_HW_RESET;
>  		writel(reg, priv->control);
> -		mdelay(10);
> +		usleep_range(10000, 11000);

This does not apply:
checking file drivers/thermal/armada_thermal.c
Hunk #1 FAILED at 143.
1 out of 1 hunk FAILED

That mdelay() is not existing anymore.

>  	}
>  }
>  
> -- 
> 1.9.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-04-27  2:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10  8:13 [PATCH 3/3] thermal: armada_thermal: Replace mdelay with usleep_range in armada380_init_sensor Jia-Ju Bai
2018-04-27  2:13 ` Eduardo Valentin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.