lkml.org 
[lkml]   [2011]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [v2 3/4] platform: (TS-5500) add LED support
On Tue, 30 Aug 2011 15:04:00 -0700,
"H. Peter Anvin" <hpa@zytor.com> wrote:

> On 08/30/2011 02:56 PM, Vivien Didelot wrote:
> >>
> > I wrote the led_set function like:
> >
> > static void ts5500_led_set(struct led_classdev *led_cdev,
> > enum led_brightness value)
> > {
> > struct ts5500_led *led = container_of(led_cdev,
> > struct ts5500_led,
> > cdev);
> > mutex_lock(&led->lock);
> > led->new_brightness = (value == LED_OFF) ? LED_OFF :
> > LED_FULL; outb(value, led->ioaddr);
> > mutex_unlock(&led->lock);
> > }
> >
> > I guess the wrong value could be read if we get preempted just
> > before the outb() call, am I wrong?
> >
>
> And what happens if we do?
>
> P.S. Your canonicalization of the value doesn't extend to outb().
>
> -hpa

In fact the new_brightness field wasn't necessary in this driver, so I
removed it and now the function only contains the outb() call. Thanks.

Vivien


\
 
 \ /
  Last update: 2011-08-31 22:03    [W:0.064 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site