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/backlight.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/backlight.c')
-rw-r--r-- | drivers/video/backlight/backlight.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index b800cd4eeec8..68bb838b9f11 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c | |||
@@ -269,7 +269,8 @@ EXPORT_SYMBOL(backlight_force_update); | |||
269 | * ERR_PTR() or a pointer to the newly allocated device. | 269 | * ERR_PTR() or a pointer to the newly allocated device. |
270 | */ | 270 | */ |
271 | struct backlight_device *backlight_device_register(const char *name, | 271 | struct backlight_device *backlight_device_register(const char *name, |
272 | struct device *parent, void *devdata, const struct backlight_ops *ops) | 272 | struct device *parent, void *devdata, const struct backlight_ops *ops, |
273 | const struct backlight_properties *props) | ||
273 | { | 274 | { |
274 | struct backlight_device *new_bd; | 275 | struct backlight_device *new_bd; |
275 | int rc; | 276 | int rc; |
@@ -289,6 +290,11 @@ struct backlight_device *backlight_device_register(const char *name, | |||
289 | dev_set_name(&new_bd->dev, name); | 290 | dev_set_name(&new_bd->dev, name); |
290 | dev_set_drvdata(&new_bd->dev, devdata); | 291 | dev_set_drvdata(&new_bd->dev, devdata); |
291 | 292 | ||
293 | /* Set default properties */ | ||
294 | if (props) | ||
295 | memcpy(&new_bd->props, props, | ||
296 | sizeof(struct backlight_properties)); | ||
297 | |||
292 | rc = device_register(&new_bd->dev); | 298 | rc = device_register(&new_bd->dev); |
293 | if (rc) { | 299 | if (rc) { |
294 | kfree(new_bd); | 300 | kfree(new_bd); |