Michael Hanselmann <[EMAIL PROTECTED]> wrote: > > +#include <asm/semaphore.h>
backlight_device would appear to need mutex conversion. Then again, maybe we take backlight_device.sem recursively - I do recall some pretty wild happenings in there. > +static void appledisplay_work(void *private) > +{ > + struct appledisplay *pdata = private; > + int retval; > + > + up(&pdata->bd->sem); > + retval = appledisplay_bl_get_brightness(pdata->bd); > + if (retval >= 0) > + pdata->bd->props->brightness = retval; > + down(&pdata->bd->sem); > + > + /* Poll again in about 125ms if there's still a button pressed */ > + if (pdata->button_pressed) > + schedule_delayed_work(&pdata->work, HZ / 8); > +} Gee it's odd to go upping a semaphore on entry to a schedule_work() handler. What's going on here? > +static int appledisplay_probe(struct usb_interface *iface, > + const struct usb_device_id *id) > +{ > > .. > > + /* Try to get brightness */ > + up(&pdata->bd->sem); > + brightness = appledisplay_bl_get_brightness(pdata->bd); > + down(&pdata->bd->sem); This looks fishy too. appledisplay_bl_get_brightness() doesn't appear to take that semaphore, so why drop the lock? > + if (brightness < 0) { > + retval = brightness; > + err("appledisplay: Error while getting initial brightness: %d", > retval); > + goto error; > + } > + > + /* Set brightness in backlight device */ > + up(&pdata->bd->sem); > + pdata->bd->props->brightness = brightness; > + down(&pdata->bd->sem); Ditto. If it's attempting to synchronise against appledisplay_work() in some way then I'd have thought it was racy.. > +config USB_APPLEDISPLAY I have such a display - shall try to remember to test the driver, thanks. ------------------------------------------------------- All the advantages of Linux Managed Hosting--Without the Cost and Risk! Fully trained technicians. The highest number of Red Hat certifications in the hosting industry. Fanatical Support. Click to learn more http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel