diff options
author | Matthew Garrett <mjg@redhat.com> | 2010-02-17 16:39:44 -0500 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-03-16 15:47:54 -0400 |
commit | a19a6ee6cad2b20292a774c2f56ba8039b0fac9c (patch) | |
tree | 631916ce6181336c5c28eb0cf5484c40c92986b6 /drivers/usb/misc/appledisplay.c | |
parent | 57e148b6a975980944f4466ccb669b1d02dfc6a1 (diff) |
backlight: Allow properties to be passed at registration
Values such as max_brightness should be set before backlights are
registered, but the current API doesn't allow that. Add a parameter to
backlight_device_register and update drivers to ensure that they
set this correctly.
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'drivers/usb/misc/appledisplay.c')
-rw-r--r-- | drivers/usb/misc/appledisplay.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c index 4d2952f1fb13..3adab041355a 100644 --- a/drivers/usb/misc/appledisplay.c +++ b/drivers/usb/misc/appledisplay.c | |||
@@ -202,6 +202,7 @@ static void appledisplay_work(struct work_struct *work) | |||
202 | static int appledisplay_probe(struct usb_interface *iface, | 202 | static int appledisplay_probe(struct usb_interface *iface, |
203 | const struct usb_device_id *id) | 203 | const struct usb_device_id *id) |
204 | { | 204 | { |
205 | struct backlight_properties props; | ||
205 | struct appledisplay *pdata; | 206 | struct appledisplay *pdata; |
206 | struct usb_device *udev = interface_to_usbdev(iface); | 207 | struct usb_device *udev = interface_to_usbdev(iface); |
207 | struct usb_host_interface *iface_desc; | 208 | struct usb_host_interface *iface_desc; |
@@ -279,16 +280,16 @@ static int appledisplay_probe(struct usb_interface *iface, | |||
279 | /* Register backlight device */ | 280 | /* Register backlight device */ |
280 | snprintf(bl_name, sizeof(bl_name), "appledisplay%d", | 281 | snprintf(bl_name, sizeof(bl_name), "appledisplay%d", |
281 | atomic_inc_return(&count_displays) - 1); | 282 | atomic_inc_return(&count_displays) - 1); |
283 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
284 | props.max_brightness = 0xff; | ||
282 | pdata->bd = backlight_device_register(bl_name, NULL, pdata, | 285 | pdata->bd = backlight_device_register(bl_name, NULL, pdata, |
283 | &appledisplay_bl_data); | 286 | &appledisplay_bl_data, &props); |
284 | if (IS_ERR(pdata->bd)) { | 287 | if (IS_ERR(pdata->bd)) { |
285 | dev_err(&iface->dev, "Backlight registration failed\n"); | 288 | dev_err(&iface->dev, "Backlight registration failed\n"); |
286 | retval = PTR_ERR(pdata->bd); | 289 | retval = PTR_ERR(pdata->bd); |
287 | goto error; | 290 | goto error; |
288 | } | 291 | } |
289 | 292 | ||
290 | pdata->bd->props.max_brightness = 0xff; | ||
291 | |||
292 | /* Try to get brightness */ | 293 | /* Try to get brightness */ |
293 | brightness = appledisplay_bl_get_brightness(pdata->bd); | 294 | brightness = appledisplay_bl_get_brightness(pdata->bd); |
294 | 295 | ||