diff mbox series

leds: sun50i-a100: Replace msleep() with usleep_range()

Message ID 20240816171129.6411-1-abhishektamboli9@gmail.com
State New
Headers show
Series leds: sun50i-a100: Replace msleep() with usleep_range() | expand

Commit Message

Abhishek Tamboli Aug. 16, 2024, 5:11 p.m. UTC
Replace msleep() with usleep_range() in sun50i_a100_ledc_suspend()
to address the checkpatch.pl warning. msleep() for such short delay
can lead to inaccurate sleep times. Switch to usleep_range()
provide more precise delay.

Fix the following warning from checkpatch.pl:

WARNING: msleep < 20ms can sleep for up to 20ms;
see Documentation/timers/timers-howto.rst
+		msleep(1);

Signed-off-by: Abhishek Tamboli <abhishektamboli9@gmail.com>
---
 drivers/leds/leds-sun50i-a100.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.34.1

Comments

Chen-Yu Tsai Aug. 19, 2024, 4:25 p.m. UTC | #1
On Sat, Aug 17, 2024 at 1:12 AM Abhishek Tamboli
<abhishektamboli9@gmail.com> wrote:
>
> Replace msleep() with usleep_range() in sun50i_a100_ledc_suspend()
> to address the checkpatch.pl warning. msleep() for such short delay
> can lead to inaccurate sleep times. Switch to usleep_range()
> provide more precise delay.
>
> Fix the following warning from checkpatch.pl:
>
> WARNING: msleep < 20ms can sleep for up to 20ms;
> see Documentation/timers/timers-howto.rst
> +               msleep(1);
>
> Signed-off-by: Abhishek Tamboli <abhishektamboli9@gmail.com>

Acked-by: Chen-Yu Tsai <wens@csie.org>
Lee Jones Aug. 22, 2024, 10:39 a.m. UTC | #2
On Fri, 16 Aug 2024 22:41:29 +0530, Abhishek Tamboli wrote:
> Replace msleep() with usleep_range() in sun50i_a100_ledc_suspend()
> to address the checkpatch.pl warning. msleep() for such short delay
> can lead to inaccurate sleep times. Switch to usleep_range()
> provide more precise delay.
> 
> Fix the following warning from checkpatch.pl:
> 
> [...]

Applied, thanks!

[1/1] leds: sun50i-a100: Replace msleep() with usleep_range()
      commit: 8f3f07517834382e819e168740bf855273f13d47

--
Lee Jones [李琼斯]
diff mbox series

Patch

diff --git a/drivers/leds/leds-sun50i-a100.c b/drivers/leds/leds-sun50i-a100.c
index 119eff9471f0..4c468d487486 100644
--- a/drivers/leds/leds-sun50i-a100.c
+++ b/drivers/leds/leds-sun50i-a100.c
@@ -368,7 +368,7 @@  static int sun50i_a100_ledc_suspend(struct device *dev)
 		if (!xfer_active)
 			break;

-		msleep(1);
+		usleep_range(1000, 1100);
 	}

 	clk_disable_unprepare(priv->mod_clk);