From a19a6ee6cad2b20292a774c2f56ba8039b0fac9c Mon Sep 17 00:00:00 2001 From: Matthew Garrett Date: Wed, 17 Feb 2010 16:39:44 -0500 Subject: 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 Signed-off-by: Richard Purdie --- drivers/usb/misc/appledisplay.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/usb/misc') 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) static int appledisplay_probe(struct usb_interface *iface, const struct usb_device_id *id) { + struct backlight_properties props; struct appledisplay *pdata; struct usb_device *udev = interface_to_usbdev(iface); struct usb_host_interface *iface_desc; @@ -279,16 +280,16 @@ 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); + memset(&props, 0, sizeof(struct backlight_properties)); + props.max_brightness = 0xff; pdata->bd = backlight_device_register(bl_name, NULL, pdata, - &appledisplay_bl_data); + &appledisplay_bl_data, &props); if (IS_ERR(pdata->bd)) { dev_err(&iface->dev, "Backlight registration failed\n"); retval = PTR_ERR(pdata->bd); goto error; } - pdata->bd->props.max_brightness = 0xff; - /* Try to get brightness */ brightness = appledisplay_bl_get_brightness(pdata->bd); -- cgit v1.2.3-59-g8ed1b