diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/usb/misc/appledisplay.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/usb/misc/appledisplay.c')
-rw-r--r-- | drivers/usb/misc/appledisplay.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c index 1d8e39a557d9..094f91cbc578 100644 --- a/drivers/usb/misc/appledisplay.c +++ b/drivers/usb/misc/appledisplay.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/slab.h> | ||
27 | #include <linux/usb.h> | 28 | #include <linux/usb.h> |
28 | #include <linux/backlight.h> | 29 | #include <linux/backlight.h> |
29 | #include <linux/timer.h> | 30 | #include <linux/timer.h> |
@@ -57,9 +58,10 @@ | |||
57 | .bInterfaceProtocol = 0x00 | 58 | .bInterfaceProtocol = 0x00 |
58 | 59 | ||
59 | /* table of devices that work with this driver */ | 60 | /* table of devices that work with this driver */ |
60 | static struct usb_device_id appledisplay_table [] = { | 61 | static const struct usb_device_id appledisplay_table[] = { |
61 | { APPLEDISPLAY_DEVICE(0x9218) }, | 62 | { APPLEDISPLAY_DEVICE(0x9218) }, |
62 | { APPLEDISPLAY_DEVICE(0x9219) }, | 63 | { APPLEDISPLAY_DEVICE(0x9219) }, |
64 | { APPLEDISPLAY_DEVICE(0x921c) }, | ||
63 | { APPLEDISPLAY_DEVICE(0x921d) }, | 65 | { APPLEDISPLAY_DEVICE(0x921d) }, |
64 | 66 | ||
65 | /* Terminating entry */ | 67 | /* Terminating entry */ |
@@ -72,8 +74,8 @@ struct appledisplay { | |||
72 | struct usb_device *udev; /* usb device */ | 74 | struct usb_device *udev; /* usb device */ |
73 | struct urb *urb; /* usb request block */ | 75 | struct urb *urb; /* usb request block */ |
74 | struct backlight_device *bd; /* backlight device */ | 76 | struct backlight_device *bd; /* backlight device */ |
75 | char *urbdata; /* interrupt URB data buffer */ | 77 | u8 *urbdata; /* interrupt URB data buffer */ |
76 | char *msgdata; /* control message data buffer */ | 78 | u8 *msgdata; /* control message data buffer */ |
77 | 79 | ||
78 | struct delayed_work work; | 80 | struct delayed_work work; |
79 | int button_pressed; | 81 | int button_pressed; |
@@ -178,7 +180,7 @@ static int appledisplay_bl_get_brightness(struct backlight_device *bd) | |||
178 | return pdata->msgdata[1]; | 180 | return pdata->msgdata[1]; |
179 | } | 181 | } |
180 | 182 | ||
181 | static struct backlight_ops appledisplay_bl_data = { | 183 | static const struct backlight_ops appledisplay_bl_data = { |
182 | .get_brightness = appledisplay_bl_get_brightness, | 184 | .get_brightness = appledisplay_bl_get_brightness, |
183 | .update_status = appledisplay_bl_update_status, | 185 | .update_status = appledisplay_bl_update_status, |
184 | }; | 186 | }; |
@@ -201,6 +203,7 @@ static void appledisplay_work(struct work_struct *work) | |||
201 | static int appledisplay_probe(struct usb_interface *iface, | 203 | static int appledisplay_probe(struct usb_interface *iface, |
202 | const struct usb_device_id *id) | 204 | const struct usb_device_id *id) |
203 | { | 205 | { |
206 | struct backlight_properties props; | ||
204 | struct appledisplay *pdata; | 207 | struct appledisplay *pdata; |
205 | struct usb_device *udev = interface_to_usbdev(iface); | 208 | struct usb_device *udev = interface_to_usbdev(iface); |
206 | struct usb_host_interface *iface_desc; | 209 | struct usb_host_interface *iface_desc; |
@@ -278,15 +281,16 @@ static int appledisplay_probe(struct usb_interface *iface, | |||
278 | /* Register backlight device */ | 281 | /* Register backlight device */ |
279 | snprintf(bl_name, sizeof(bl_name), "appledisplay%d", | 282 | snprintf(bl_name, sizeof(bl_name), "appledisplay%d", |
280 | atomic_inc_return(&count_displays) - 1); | 283 | atomic_inc_return(&count_displays) - 1); |
284 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
285 | props.max_brightness = 0xff; | ||
281 | pdata->bd = backlight_device_register(bl_name, NULL, pdata, | 286 | pdata->bd = backlight_device_register(bl_name, NULL, pdata, |
282 | &appledisplay_bl_data); | 287 | &appledisplay_bl_data, &props); |
283 | if (IS_ERR(pdata->bd)) { | 288 | if (IS_ERR(pdata->bd)) { |
284 | dev_err(&iface->dev, "Backlight registration failed\n"); | 289 | dev_err(&iface->dev, "Backlight registration failed\n"); |
290 | retval = PTR_ERR(pdata->bd); | ||
285 | goto error; | 291 | goto error; |
286 | } | 292 | } |
287 | 293 | ||
288 | pdata->bd->props.max_brightness = 0xff; | ||
289 | |||
290 | /* Try to get brightness */ | 294 | /* Try to get brightness */ |
291 | brightness = appledisplay_bl_get_brightness(pdata->bd); | 295 | brightness = appledisplay_bl_get_brightness(pdata->bd); |
292 | 296 | ||