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 <[email protected]>
Signed-off-by: Richard Purdie <[email protected]>
This commit is contained in:
Matthew Garrett 2010-02-17 16:39:44 -05:00 • committed by Richard Purdie
commit a19a6ee6ca
49 changed files with 271 additions and 151 deletions

View file

@ -998,6 +998,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
}
if (acpi_video_backlight_support()) {
struct backlight_properties props;
int result;
static int count = 0;
char *name;
@ -1010,12 +1011,14 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
return;
sprintf(name, "acpi_video%d", count++);
device->backlight = backlight_device_register(name,
NULL, device, &acpi_backlight_ops);
memset(&props, 0, sizeof(struct backlight_properties));
props.max_brightness = device->brightness->count - 3;
device->backlight = backlight_device_register(name, NULL, device,
&acpi_backlight_ops,
&props);
kfree(name);
if (IS_ERR(device->backlight))
return;
device->backlight->props.max_brightness = device->brightness->count-3;
result = sysfs_create_link(&device->backlight->dev.kobj,
&device->dev->dev.kobj, "device");