aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video.c
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-02-10 18:07:48 -0500
committerRichard Purdie <rpurdie@rpsys.net>2007-02-20 04:26:53 -0500
commit599a52d12629394236d785615808845823875868 (patch)
tree4e2dfa3a25ce761be0ecc0490acabac553f77a67 /drivers/acpi/video.c
parent321709c5994f952b78d567fd7083dbebbdc381b7 (diff)
backlight: Separate backlight properties from backlight ops pointers
Per device data such as brightness belongs to the indivdual device and should therefore be separate from the the backlight operation function pointers. This patch splits the two types of data and allows simplifcation of some code. Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r--drivers/acpi/video.c35
1 files changed, 12 insertions, 23 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 75e422bd926a..0771b434feb2 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -169,7 +169,6 @@ struct acpi_video_device {
169 struct acpi_device *dev; 169 struct acpi_device *dev;
170 struct acpi_video_device_brightness *brightness; 170 struct acpi_video_device_brightness *brightness;
171 struct backlight_device *backlight; 171 struct backlight_device *backlight;
172 struct backlight_properties *data;
173}; 172};
174 173
175/* bus */ 174/* bus */
@@ -286,13 +285,18 @@ static int acpi_video_get_brightness(struct backlight_device *bd)
286 285
287static int acpi_video_set_brightness(struct backlight_device *bd) 286static int acpi_video_set_brightness(struct backlight_device *bd)
288{ 287{
289 int request_level = bd->props->brightness; 288 int request_level = bd->props.brightness;
290 struct acpi_video_device *vd = 289 struct acpi_video_device *vd =
291 (struct acpi_video_device *)class_get_devdata(&bd->class_dev); 290 (struct acpi_video_device *)class_get_devdata(&bd->class_dev);
292 acpi_video_device_lcd_set_level(vd, request_level); 291 acpi_video_device_lcd_set_level(vd, request_level);
293 return 0; 292 return 0;
294} 293}
295 294
295static struct backlight_ops acpi_backlight_ops = {
296 .get_brightness = acpi_video_get_brightness,
297 .update_status = acpi_video_set_brightness,
298};
299
296/* -------------------------------------------------------------------------- 300/* --------------------------------------------------------------------------
297 Video Management 301 Video Management
298 -------------------------------------------------------------------------- */ 302 -------------------------------------------------------------------------- */
@@ -608,30 +612,18 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
608 unsigned long tmp; 612 unsigned long tmp;
609 static int count = 0; 613 static int count = 0;
610 char *name; 614 char *name;
611 struct backlight_properties *acpi_video_data;
612
613 name = kzalloc(MAX_NAME_LEN, GFP_KERNEL); 615 name = kzalloc(MAX_NAME_LEN, GFP_KERNEL);
614 if (!name) 616 if (!name)
615 return; 617 return;
616 618
617 acpi_video_data = kzalloc(
618 sizeof(struct backlight_properties),
619 GFP_KERNEL);
620 if (!acpi_video_data){
621 kfree(name);
622 return;
623 }
624 acpi_video_data->get_brightness =
625 acpi_video_get_brightness;
626 acpi_video_data->update_status =
627 acpi_video_set_brightness;
628 sprintf(name, "acpi_video%d", count++); 619 sprintf(name, "acpi_video%d", count++);
629 device->data = acpi_video_data;
630 acpi_video_data->max_brightness = max_level;
631 acpi_video_device_lcd_get_level_current(device, &tmp); 620 acpi_video_device_lcd_get_level_current(device, &tmp);
632 acpi_video_data->brightness = (int)tmp;
633 device->backlight = backlight_device_register(name, 621 device->backlight = backlight_device_register(name,
634 NULL, device, acpi_video_data); 622 NULL, device, &acpi_backlight_ops);
623 device->backlight->props.max_brightness = max_level;
624 device->backlight->props.brightness = (int)tmp;
625 backlight_update_status(device->backlight);
626
635 kfree(name); 627 kfree(name);
636 } 628 }
637 return; 629 return;
@@ -1676,10 +1668,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device)
1676 status = acpi_remove_notify_handler(device->dev->handle, 1668 status = acpi_remove_notify_handler(device->dev->handle,
1677 ACPI_DEVICE_NOTIFY, 1669 ACPI_DEVICE_NOTIFY,
1678 acpi_video_device_notify); 1670 acpi_video_device_notify);
1679 if (device->backlight){ 1671 backlight_device_unregister(device->backlight);
1680 backlight_device_unregister(device->backlight);
1681 kfree(device->data);
1682 }
1683 return 0; 1672 return 0;
1684} 1673}
1685 1674