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/video/backlight/adp5520_bl.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/video/backlight/adp5520_bl.c')
-rw-r--r-- | drivers/video/backlight/adp5520_bl.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/video/backlight/adp5520_bl.c b/drivers/video/backlight/adp5520_bl.c index 86d95c228adb..5183f0e4d314 100644 --- a/drivers/video/backlight/adp5520_bl.c +++ b/drivers/video/backlight/adp5520_bl.c | |||
@@ -278,6 +278,7 @@ static const struct attribute_group adp5520_bl_attr_group = { | |||
278 | 278 | ||
279 | static int __devinit adp5520_bl_probe(struct platform_device *pdev) | 279 | static int __devinit adp5520_bl_probe(struct platform_device *pdev) |
280 | { | 280 | { |
281 | struct backlight_properties props; | ||
281 | struct backlight_device *bl; | 282 | struct backlight_device *bl; |
282 | struct adp5520_bl *data; | 283 | struct adp5520_bl *data; |
283 | int ret = 0; | 284 | int ret = 0; |
@@ -300,17 +301,17 @@ static int __devinit adp5520_bl_probe(struct platform_device *pdev) | |||
300 | 301 | ||
301 | mutex_init(&data->lock); | 302 | mutex_init(&data->lock); |
302 | 303 | ||
303 | bl = backlight_device_register(pdev->name, data->master, | 304 | memset(&props, 0, sizeof(struct backlight_properties)); |
304 | data, &adp5520_bl_ops); | 305 | props.max_brightness = ADP5020_MAX_BRIGHTNESS; |
306 | bl = backlight_device_register(pdev->name, data->master, data, | ||
307 | &adp5520_bl_ops, &props); | ||
305 | if (IS_ERR(bl)) { | 308 | if (IS_ERR(bl)) { |
306 | dev_err(&pdev->dev, "failed to register backlight\n"); | 309 | dev_err(&pdev->dev, "failed to register backlight\n"); |
307 | kfree(data); | 310 | kfree(data); |
308 | return PTR_ERR(bl); | 311 | return PTR_ERR(bl); |
309 | } | 312 | } |
310 | 313 | ||
311 | bl->props.max_brightness = | 314 | bl->props.brightness = ADP5020_MAX_BRIGHTNESS; |
312 | bl->props.brightness = ADP5020_MAX_BRIGHTNESS; | ||
313 | |||
314 | if (data->pdata->en_ambl_sens) | 315 | if (data->pdata->en_ambl_sens) |
315 | ret = sysfs_create_group(&bl->dev.kobj, | 316 | ret = sysfs_create_group(&bl->dev.kobj, |
316 | &adp5520_bl_attr_group); | 317 | &adp5520_bl_attr_group); |