thermal: rcar_thermal: Use usleep_range() instead of udelay()
diff mbox series

Message ID 20200115125417.5263-1-geert+renesas@glider.be
State Accepted
Delegated to: Daniel Lezcano
Headers show
Series
  • thermal: rcar_thermal: Use usleep_range() instead of udelay()
Related show

Commit Message

Geert Uytterhoeven Jan. 15, 2020, 12:54 p.m. UTC
rcar_thermal_update_temp() takes a mutex, so it is always called in a
context that can sleep.  Hence replace the 300 µs busy loop by a call to
usleep_range(), to allow other threads to run.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/thermal/rcar_thermal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Lezcano Jan. 15, 2020, 1:17 p.m. UTC | #1
On 15/01/2020 13:54, Geert Uytterhoeven wrote:
> rcar_thermal_update_temp() takes a mutex, so it is always called in a
> context that can sleep.  Hence replace the 300 µs busy loop by a call to
> usleep_range(), to allow other threads to run.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  drivers/thermal/rcar_thermal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
> index d0873de718da9218..a8dd96d2d24c4ce5 100644
> --- a/drivers/thermal/rcar_thermal.c
> +++ b/drivers/thermal/rcar_thermal.c
> @@ -219,7 +219,7 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
>  		 * to get stable temperature.
>  		 * see "Usage Notes" on datasheet
>  		 */
> -		udelay(300);
> +		usleep_range(300, 400);
>  
>  		new = rcar_thermal_read(priv, THSSR) & CTEMP;
>  		if (new == old) {
> 

Applied to the testing branch. If there is no problem it will be merged
to the linux-next branch.

  -- Daniel

Patch
diff mbox series

diff --git a/drivers/thermal/rcar_thermal.c b/drivers/thermal/rcar_thermal.c
index d0873de718da9218..a8dd96d2d24c4ce5 100644
--- a/drivers/thermal/rcar_thermal.c
+++ b/drivers/thermal/rcar_thermal.c
@@ -219,7 +219,7 @@  static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
 		 * to get stable temperature.
 		 * see "Usage Notes" on datasheet
 		 */
-		udelay(300);
+		usleep_range(300, 400);
 
 		new = rcar_thermal_read(priv, THSSR) & CTEMP;
 		if (new == old) {