aboutsummaryrefslogtreecommitdiff
path: root/drivers/usb/misc/appledisplay.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc/appledisplay.c')
-rw-r--r--drivers/usb/misc/appledisplay.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index 32f0e3a5b02..cf70c16f0e3 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -141,7 +141,7 @@ static int appledisplay_bl_update_status(struct backlight_device *bd)
int retval;
pdata->msgdata[0] = 0x10;
- pdata->msgdata[1] = bd->props->brightness;
+ pdata->msgdata[1] = bd->props.brightness;
retval = usb_control_msg(
pdata->udev,
@@ -177,11 +177,9 @@ static int appledisplay_bl_get_brightness(struct backlight_device *bd)
return pdata->msgdata[1];
}
-static struct backlight_properties appledisplay_bl_data = {
- .owner = THIS_MODULE,
+static struct backlight_ops appledisplay_bl_data = {
.get_brightness = appledisplay_bl_get_brightness,
.update_status = appledisplay_bl_update_status,
- .max_brightness = 0xFF
};
static void appledisplay_work(struct work_struct *work)
@@ -190,11 +188,9 @@ static void appledisplay_work(struct work_struct *work)
container_of(work, struct appledisplay, work.work);
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);
+ pdata->bd->props.brightness = retval;
/* Poll again in about 125ms if there's still a button pressed */
if (pdata->button_pressed)
@@ -281,17 +277,17 @@ static int appledisplay_probe(struct usb_interface *iface,
/* Register backlight device */
snprintf(bl_name, sizeof(bl_name), "appledisplay%d",
atomic_inc_return(&count_displays) - 1);
- pdata->bd = backlight_device_register(bl_name, NULL,
- pdata, &appledisplay_bl_data);
+ pdata->bd = backlight_device_register(bl_name, NULL, pdata,
+ &appledisplay_bl_data);
if (IS_ERR(pdata->bd)) {
err("appledisplay: Backlight registration failed");
goto error;
}
+ pdata->bd->props.max_brightness = 0xff;
+
/* Try to get brightness */
- up(&pdata->bd->sem);
brightness = appledisplay_bl_get_brightness(pdata->bd);
- down(&pdata->bd->sem);
if (brightness < 0) {
retval = brightness;
@@ -300,9 +296,7 @@ static int appledisplay_probe(struct usb_interface *iface,
}
/* Set brightness in backlight device */
- up(&pdata->bd->sem);
- pdata->bd->props->brightness = brightness;
- down(&pdata->bd->sem);
+ pdata->bd->props.brightness = brightness;
/* save our data pointer in the interface device */
usb_set_intfdata(iface, pdata);