backlight: da9052: Use usleep_range() instead of msleep() for small sleeps
PATCH 1/3 backlight: da9052: Use usleep_range() instead of msleep() for small sleeps
Since msleep might not sleep for the desired amount when less than 20ms, use usleep_range.
--- drivers/video/backlight/da9052_bl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/video/backlight/da9052_bl.c +1 -1
@@ -72,7 +72,7 @@ static int da9052_adjust_wled_brightness(struct da9052_bl *wleds)if (ret <0 )return ret; -msleep (10 ); +usleep_range (10000 ,11000 );if (wleds->brightness) { ret = da9052_reg_write(wleds->da9052, wled_bank[wleds->led_reg],
Signature · 1 line
1.7.1
Hi Jingoo,
Quoted 15 lines · Jingoo Han
Since msleep might not sleep for the desired amount when less than 20ms, use
usleep_range.Cc Ashish Jangam <[email protected]>Cc Richard Purdie <[email protected]>Signed-off-by Jingoo Han <[email protected]>--- drivers/video/backlight/da9052_bl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/video/backlight/da9052_bl.c +0
-0
drivers/video/backlight/da9052_bl.c static int da9052_adjust_wled_brightness(struct da9052_bl *wleds) · line 75
Quoted 5 lines
drivers/video/backlight/da9052_bl.c +1
-1@@ -72,7 +72,7 @@ static int da9052_adjust_wled_brightness(struct da9052_bl *wleds)if (ret <0 )return ret; -msleep (10 ); +usleep_range (10000 ,11000 );
Can't we just use usleep(10000) instead?
Quoted 12 lines
drivers/video/backlight/da9052_bl.c +0
-1if (wleds->brightness) { ret = da9052_reg_write(wleds->da9052, wled_bank[wleds->led_reg], --1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Signature · 2 lines
With warm regards, Sachin
Quoted 22 lines · Sachin Kamat
Hi Jingoo,
Quoted 18 lines · Jingoo Han
Since msleep might not sleep for the desired amount when less than 20ms, use
usleep_range.Cc Ashish Jangam <[email protected]>Cc Richard Purdie <[email protected]>Signed-off-by Jingoo Han <[email protected]>--- drivers/video/backlight/da9052_bl.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/video/backlight/da9052_bl.c +0
-0@@ -72,7 +72,7 @@ static int da9052_adjust_wled_brightness(struct da9052_bl *wleds)if (ret <0 )return ret;
Quoted 4 lines
drivers/video/backlight/da9052_bl.c static int da9052_adjust_wled_brightness(struct da9052_bl *wleds) · line 75
Quoted 2 lines
drivers/video/backlight/da9052_bl.c +1
-1-msleep (10 ); +usleep_range (10000 ,11000 );Can't we just use usleep(10000) instead?
usleep() is not available.
For more details, refer to Documentation/timers/timers-howto.txt.
Quoted 20 lines
Quoted 9 lines
drivers/video/backlight/da9052_bl.c +0
-1if (wleds->brightness) { ret = da9052_reg_write(wleds->da9052, wled_bank[wleds->led_reg], --1.7.1
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/--
With warm regards,
Sachin
Quoted 8 lines · Jingoo Han
Quoted 3 lines · Sachin Kamat
Quoted 1 line
+
usleep_range(10000, 11000);Can't we just use usleep(10000) instead?
usleep()is not available.
For more details, refer toDocumentation/timers/timers-howto.txt.
Given how common this pattern is is it not more sensible to just provide usleep() even if just as an inline that's something like
void usleep(unsigned long t)
{
usleep_range(t, t + (t / 10));
}since the usleep_range() isn't ideal for clarity (and usually the upper bound isn't a particular concern for the driver, it just wants the usual "delay for at least x" semantics).