Help!

[PATCH 1/3] backlight: da9052: Use usleep_range() instead ..

 
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Kernel RSS
Next:  [gentoo-user] Gentoo on a Beaglebone  
Author Message
Jingoo Han
External


Since: Dec 12, 2011
Posts: 35



PostPosted: Mon Aug 06, 2012 2:10 am    Post subject: [PATCH 1/3] backlight: da9052: Use usleep_range() instead of msleep() for small sleeps
Archived from groups: linux>kernel (more info?)


Since msleep might not sleep for the desired amount when less
than 20ms, use usleep_range.

Cc: Ashish Jangam
Cc: Richard Purdie
Signed-off-by: Jingoo Han
---
drivers/video/backlight/da9052_bl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c
index b628d68..10485c9 100644
--- a/drivers/video/backlight/da9052_bl.c
+++ b/drivers/video/backlight/da9052_bl.c
@@ -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],
--
1.7.1


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Sachin Kamat
External


Since: Apr 30, 2012
Posts: 18



PostPosted: Mon Aug 06, 2012 2:10 am    Post subject: Re: [PATCH 1/3] backlight: da9052: Use usleep_range() instead of msleep() for small sleeps [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hi Jingoo,

On 6 August 2012 10:13, Jingoo Han wrote:
> Since msleep might not sleep for the desired amount when less
> than 20ms, use usleep_range.
>
> Cc: Ashish Jangam
> Cc: Richard Purdie
> Signed-off-by: Jingoo Han
> ---
> drivers/video/backlight/da9052_bl.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c
> index b628d68..10485c9 100644
> --- a/drivers/video/backlight/da9052_bl.c
> +++ b/drivers/video/backlight/da9052_bl.c
> @@ -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?


>
> if (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 majordomo RemoveThis @vger.kernel.org
> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Jingoo Han
External


Since: Dec 12, 2011
Posts: 35



PostPosted: Mon Aug 06, 2012 2:10 am    Post subject: Re: [PATCH 1/3] backlight: da9052: Use usleep_range() instead of msleep() for small sleeps [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Monday, August 06, 2012 1:48 PM Sachin Kamat wrote:
>
> Hi Jingoo,
>
> On 6 August 2012 10:13, Jingoo Han wrote:
> > Since msleep might not sleep for the desired amount when less
> > than 20ms, use usleep_range.
> >
> > Cc: Ashish Jangam
> > Cc: Richard Purdie
> > Signed-off-by: Jingoo Han
> > ---
> > drivers/video/backlight/da9052_bl.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/video/backlight/da9052_bl.c b/drivers/video/backlight/da9052_bl.c
> > index b628d68..10485c9 100644
> > --- a/drivers/video/backlight/da9052_bl.c
> > +++ b/drivers/video/backlight/da9052_bl.c
> > @@ -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?


usleep() is not available.
For more details, refer to Documentation/timers/timers-howto.txt.


>
>
> >
> > if (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 majordomo RemoveThis @vger.kernel.org
> > 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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Mark Brown
External


Since: Jan 12, 2009
Posts: 550



PostPosted: Tue Aug 07, 2012 1:10 pm    Post subject: Re: [PATCH 1/3] backlight: da9052: Use usleep_range() instead of msleep() for small sleeps [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Mon, Aug 06, 2012 at 01:59:38PM +0900, Jingoo Han wrote:
> On Monday, August 06, 2012 1:48 PM Sachin Kamat wrote:

> > > + 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.

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).
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Display posts from previous:   
Post new topic   General Reply to Topic (not reply to a specific post)    Forums Home -> Kernel All times are: Eastern Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum