aboutsummaryrefslogtreecommitdiffstats
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 32f0e3a5b022..cf70c16f0e3f 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)
141 int retval; 141 int retval;
142 142
143 pdata->msgdata[0] = 0x10; 143 pdata->msgdata[0] = 0x10;
144 pdata->msgdata[1] = bd->props->brightness; 144 pdata->msgdata[1] = bd->props.brightness;
145 145
146 retval = usb_control_msg( 146 retval = usb_control_msg(
147 pdata->udev, 147 pdata->udev,
@@ -177,11 +177,9 @@ static int appledisplay_bl_get_brightness(struct backlight_device *bd)
177 return pdata->msgdata[1]; 177 return pdata->msgdata[1];
178} 178}
179 179
180static struct backlight_properties appledisplay_bl_data = { 180static struct backlight_ops appledisplay_bl_data = {
181 .owner = THIS_MODULE,
182 .get_brightness = appledisplay_bl_get_brightness, 181 .get_brightness = appledisplay_bl_get_brightness,
183 .update_status = appledisplay_bl_update_status, 182 .update_status = appledisplay_bl_update_status,
184 .max_brightness = 0xFF
185}; 183};
186 184
187static void appledisplay_work(struct work_struct *work) 185static void appledisplay_work(struct work_struct *work)
@@ -190,11 +188,9 @@ static void appledisplay_work(struct work_struct *work)
190 container_of(work, struct appledisplay, work.work); 188 container_of(work, struct appledisplay, work.work);
191 int retval; 189 int retval;
192 190
193 up(&pdata->bd->sem);
194 retval = appledisplay_bl_get_brightness(pdata->bd); 191 retval = appledisplay_bl_get_brightness(pdata->bd);
195 if (retval >= 0) 192 if (retval >= 0)
196 pdata->bd->props->brightness = retval; 193 pdata->bd->props.brightness = retval;
197 down(&pdata->bd->sem);
198 194
199 /* Poll again in about 125ms if there's still a button pressed */ 195 /* Poll again in about 125ms if there's still a button pressed */
200 if (pdata->button_pressed) 196 if (pdata->button_pressed)
@@ -281,17 +277,17 @@ static int appledisplay_probe(struct usb_interface *iface,
281 /* Register backlight device */ 277 /* Register backlight device */
282 snprintf(bl_name, sizeof(bl_name), "appledisplay%d", 278 snprintf(bl_name, sizeof(bl_name), "appledisplay%d",
283 atomic_inc_return(&count_displays) - 1); 279 atomic_inc_return(&count_displays) - 1);
284 pdata->bd = backlight_device_register(bl_name, NULL, 280 pdata->bd = backlight_device_register(bl_name, NULL, pdata,
285 pdata, &appledisplay_bl_data); 281 &appledisplay_bl_data);
286 if (IS_ERR(pdata->bd)) { 282 if (IS_ERR(pdata->bd)) {
287 err("appledisplay: Backlight registration failed"); 283 err("appledisplay: Backlight registration failed");
288 goto error; 284 goto error;
289 } 285 }
290 286
287 pdata->bd->props.max_brightness = 0xff;
288
291 /* Try to get brightness */ 289 /* Try to get brightness */
292 up(&pdata->bd->sem);
293 brightness = appledisplay_bl_get_brightness(pdata->bd); 290 brightness = appledisplay_bl_get_brightness(pdata->bd);
294 down(&pdata->bd->sem);
295 291
296 if (brightness < 0) { 292 if (brightness < 0) {
297 retval = brightness; 293 retval = brightness;
@@ -300,9 +296,7 @@ static int appledisplay_probe(struct usb_interface *iface,
300 } 296 }
301 297
302 /* Set brightness in backlight device */ 298 /* Set brightness in backlight device */
303 up(&pdata->bd->sem); 299 pdata->bd->props.brightness = brightness;
304 pdata->bd->props->brightness = brightness;
305 down(&pdata->bd->sem);
306 300
307 /* save our data pointer in the interface device */ 301 /* save our data pointer in the interface device */
308 usb_set_intfdata(iface, pdata); 302 usb_set_intfdata(iface, pdata);