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/acpi/video.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/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 2ff2b6ab5b6c..cbe6f3924a10 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -998,6 +998,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
998 | } | 998 | } |
999 | 999 | ||
1000 | if (acpi_video_backlight_support()) { | 1000 | if (acpi_video_backlight_support()) { |
1001 | struct backlight_properties props; | ||
1001 | int result; | 1002 | int result; |
1002 | static int count = 0; | 1003 | static int count = 0; |
1003 | char *name; | 1004 | char *name; |
@@ -1010,12 +1011,14 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
1010 | return; | 1011 | return; |
1011 | 1012 | ||
1012 | sprintf(name, "acpi_video%d", count++); | 1013 | sprintf(name, "acpi_video%d", count++); |
1013 | device->backlight = backlight_device_register(name, | 1014 | memset(&props, 0, sizeof(struct backlight_properties)); |
1014 | NULL, device, &acpi_backlight_ops); | 1015 | props.max_brightness = device->brightness->count - 3; |
1016 | device->backlight = backlight_device_register(name, NULL, device, | ||
1017 | &acpi_backlight_ops, | ||
1018 | &props); | ||
1015 | kfree(name); | 1019 | kfree(name); |
1016 | if (IS_ERR(device->backlight)) | 1020 | if (IS_ERR(device->backlight)) |
1017 | return; | 1021 | return; |
1018 | device->backlight->props.max_brightness = device->brightness->count-3; | ||
1019 | 1022 | ||
1020 | result = sysfs_create_link(&device->backlight->dev.kobj, | 1023 | result = sysfs_create_link(&device->backlight->dev.kobj, |
1021 | &device->dev->dev.kobj, "device"); | 1024 | &device->dev->dev.kobj, "device"); |