diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2007-02-08 17:25:09 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2007-02-20 03:38:45 -0500 |
commit | 28ee086d5b36aab2931f6740e409bb0fb6c65e5f (patch) | |
tree | 0a308c80affcc39c2c869f29f1109e5ee9d6140f /drivers/usb | |
parent | a8db3c1948eb30cd6988b5b96b654f591e6280b1 (diff) |
backlight: Fix external uses of backlight internal semaphore
backlight_device->sem has a very specific use as documented in the
header file. The external users of this are using it for a different
reason, to serialise access to the update_status() method.
backlight users were supposed to implement their own internal
serialisation of update_status() if needed but everyone is doing
things differently and incorrectly. Therefore add a global mutex to
take care of serialisation for everyone, once and for all.
Locking for get_brightness remains optional since most users don't
need it.
Also update the lcd class in a similar way.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/misc/appledisplay.c | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c index 416cde5893af..cd2c5574cf93 100644 --- a/drivers/usb/misc/appledisplay.c +++ b/drivers/usb/misc/appledisplay.c | |||
@@ -189,11 +189,9 @@ static void appledisplay_work(struct work_struct *work) | |||
189 | container_of(work, struct appledisplay, work.work); | 189 | container_of(work, struct appledisplay, work.work); |
190 | int retval; | 190 | int retval; |
191 | 191 | ||
192 | up(&pdata->bd->sem); | ||
193 | retval = appledisplay_bl_get_brightness(pdata->bd); | 192 | retval = appledisplay_bl_get_brightness(pdata->bd); |
194 | if (retval >= 0) | 193 | if (retval >= 0) |
195 | pdata->bd->props->brightness = retval; | 194 | pdata->bd->props->brightness = retval; |
196 | down(&pdata->bd->sem); | ||
197 | 195 | ||
198 | /* Poll again in about 125ms if there's still a button pressed */ | 196 | /* Poll again in about 125ms if there's still a button pressed */ |
199 | if (pdata->button_pressed) | 197 | if (pdata->button_pressed) |
@@ -288,9 +286,7 @@ static int appledisplay_probe(struct usb_interface *iface, | |||
288 | } | 286 | } |
289 | 287 | ||
290 | /* Try to get brightness */ | 288 | /* Try to get brightness */ |
291 | up(&pdata->bd->sem); | ||
292 | brightness = appledisplay_bl_get_brightness(pdata->bd); | 289 | brightness = appledisplay_bl_get_brightness(pdata->bd); |
293 | down(&pdata->bd->sem); | ||
294 | 290 | ||
295 | if (brightness < 0) { | 291 | if (brightness < 0) { |
296 | retval = brightness; | 292 | retval = brightness; |
@@ -299,9 +295,7 @@ static int appledisplay_probe(struct usb_interface *iface, | |||
299 | } | 295 | } |
300 | 296 | ||
301 | /* Set brightness in backlight device */ | 297 | /* Set brightness in backlight device */ |
302 | up(&pdata->bd->sem); | ||
303 | pdata->bd->props->brightness = brightness; | 298 | pdata->bd->props->brightness = brightness; |
304 | down(&pdata->bd->sem); | ||
305 | 299 | ||
306 | /* save our data pointer in the interface device */ | 300 | /* save our data pointer in the interface device */ |
307 | usb_set_intfdata(iface, pdata); | 301 | usb_set_intfdata(iface, pdata); |