diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/asus_acpi.c | 6 | ||||
-rw-r--r-- | drivers/acpi/ibm_acpi.c | 7 | ||||
-rw-r--r-- | drivers/acpi/toshiba_acpi.c | 6 | ||||
-rw-r--r-- | drivers/acpi/video.c | 35 |
4 files changed, 22 insertions, 32 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index 906c54f9ba50..b770deab968c 100644 --- a/drivers/acpi/asus_acpi.c +++ b/drivers/acpi/asus_acpi.c | |||
@@ -848,7 +848,7 @@ out: | |||
848 | 848 | ||
849 | static int set_brightness_status(struct backlight_device *bd) | 849 | static int set_brightness_status(struct backlight_device *bd) |
850 | { | 850 | { |
851 | return set_brightness(bd->props->brightness); | 851 | return set_brightness(bd->props.brightness); |
852 | } | 852 | } |
853 | 853 | ||
854 | static int | 854 | static int |
@@ -1352,10 +1352,9 @@ static int asus_hotk_remove(struct acpi_device *device, int type) | |||
1352 | return 0; | 1352 | return 0; |
1353 | } | 1353 | } |
1354 | 1354 | ||
1355 | static struct backlight_properties asus_backlight_data = { | 1355 | static struct backlight_ops asus_backlight_data = { |
1356 | .get_brightness = read_brightness, | 1356 | .get_brightness = read_brightness, |
1357 | .update_status = set_brightness_status, | 1357 | .update_status = set_brightness_status, |
1358 | .max_brightness = 15, | ||
1359 | }; | 1358 | }; |
1360 | 1359 | ||
1361 | static void __exit asus_acpi_exit(void) | 1360 | static void __exit asus_acpi_exit(void) |
@@ -1409,6 +1408,7 @@ static int __init asus_acpi_init(void) | |||
1409 | asus_backlight_device = NULL; | 1408 | asus_backlight_device = NULL; |
1410 | asus_acpi_exit(); | 1409 | asus_acpi_exit(); |
1411 | } | 1410 | } |
1411 | asus_backlight_device->props.max_brightness = 15; | ||
1412 | 1412 | ||
1413 | return 0; | 1413 | return 0; |
1414 | } | 1414 | } |
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c index accf4f7da889..4cc534e36e81 100644 --- a/drivers/acpi/ibm_acpi.c +++ b/drivers/acpi/ibm_acpi.c | |||
@@ -1701,13 +1701,12 @@ static int brightness_write(char *buf) | |||
1701 | 1701 | ||
1702 | static int brightness_update_status(struct backlight_device *bd) | 1702 | static int brightness_update_status(struct backlight_device *bd) |
1703 | { | 1703 | { |
1704 | return brightness_set(bd->props->brightness); | 1704 | return brightness_set(bd->props.brightness); |
1705 | } | 1705 | } |
1706 | 1706 | ||
1707 | static struct backlight_properties ibm_backlight_data = { | 1707 | static struct backlight_ops ibm_backlight_data = { |
1708 | .get_brightness = brightness_get, | 1708 | .get_brightness = brightness_get, |
1709 | .update_status = brightness_update_status, | 1709 | .update_status = brightness_update_status, |
1710 | .max_brightness = 7, | ||
1711 | }; | 1710 | }; |
1712 | 1711 | ||
1713 | static int brightness_init(void) | 1712 | static int brightness_init(void) |
@@ -1719,6 +1718,8 @@ static int brightness_init(void) | |||
1719 | return PTR_ERR(ibm_backlight_device); | 1718 | return PTR_ERR(ibm_backlight_device); |
1720 | } | 1719 | } |
1721 | 1720 | ||
1721 | ibm_backlight_device->props.max_brightness = 7; | ||
1722 | |||
1722 | return 0; | 1723 | return 0; |
1723 | } | 1724 | } |
1724 | 1725 | ||
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c index efc3669a84e8..3906d47b9783 100644 --- a/drivers/acpi/toshiba_acpi.c +++ b/drivers/acpi/toshiba_acpi.c | |||
@@ -315,7 +315,7 @@ static int set_lcd(int value) | |||
315 | 315 | ||
316 | static int set_lcd_status(struct backlight_device *bd) | 316 | static int set_lcd_status(struct backlight_device *bd) |
317 | { | 317 | { |
318 | return set_lcd(bd->props->brightness); | 318 | return set_lcd(bd->props.brightness); |
319 | } | 319 | } |
320 | 320 | ||
321 | static unsigned long write_lcd(const char *buffer, unsigned long count) | 321 | static unsigned long write_lcd(const char *buffer, unsigned long count) |
@@ -533,10 +533,9 @@ static acpi_status __exit remove_device(void) | |||
533 | return AE_OK; | 533 | return AE_OK; |
534 | } | 534 | } |
535 | 535 | ||
536 | static struct backlight_properties toshiba_backlight_data = { | 536 | static struct backlight_ops toshiba_backlight_data = { |
537 | .get_brightness = get_lcd, | 537 | .get_brightness = get_lcd, |
538 | .update_status = set_lcd_status, | 538 | .update_status = set_lcd_status, |
539 | .max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1, | ||
540 | }; | 539 | }; |
541 | 540 | ||
542 | static void __exit toshiba_acpi_exit(void) | 541 | static void __exit toshiba_acpi_exit(void) |
@@ -596,6 +595,7 @@ static int __init toshiba_acpi_init(void) | |||
596 | toshiba_backlight_device = NULL; | 595 | toshiba_backlight_device = NULL; |
597 | toshiba_acpi_exit(); | 596 | toshiba_acpi_exit(); |
598 | } | 597 | } |
598 | toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; | ||
599 | 599 | ||
600 | return (ACPI_SUCCESS(status)) ? 0 : -ENODEV; | 600 | return (ACPI_SUCCESS(status)) ? 0 : -ENODEV; |
601 | } | 601 | } |
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 | ||
287 | static int acpi_video_set_brightness(struct backlight_device *bd) | 286 | static 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 | ||
295 | static 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 | ||