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/platform | |
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/platform')
-rw-r--r-- | drivers/platform/x86/acer-wmi.c | 7 | ||||
-rw-r--r-- | drivers/platform/x86/asus-laptop.c | 7 | ||||
-rw-r--r-- | drivers/platform/x86/asus_acpi.c | 7 | ||||
-rw-r--r-- | drivers/platform/x86/classmate-laptop.c | 8 | ||||
-rw-r--r-- | drivers/platform/x86/compal-laptop.c | 11 | ||||
-rw-r--r-- | drivers/platform/x86/dell-laptop.c | 13 | ||||
-rw-r--r-- | drivers/platform/x86/eeepc-laptop.c | 8 | ||||
-rw-r--r-- | drivers/platform/x86/fujitsu-laptop.c | 14 | ||||
-rw-r--r-- | drivers/platform/x86/msi-laptop.c | 7 | ||||
-rw-r--r-- | drivers/platform/x86/msi-wmi.c | 9 | ||||
-rw-r--r-- | drivers/platform/x86/panasonic-laptop.c | 24 | ||||
-rw-r--r-- | drivers/platform/x86/sony-laptop.c | 8 | ||||
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 12 | ||||
-rw-r--r-- | drivers/platform/x86/toshiba_acpi.c | 10 |
14 files changed, 90 insertions, 55 deletions
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 226b3e93498c..cbca40aa4006 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c | |||
@@ -922,9 +922,13 @@ static struct backlight_ops acer_bl_ops = { | |||
922 | 922 | ||
923 | static int __devinit acer_backlight_init(struct device *dev) | 923 | static int __devinit acer_backlight_init(struct device *dev) |
924 | { | 924 | { |
925 | struct backlight_properties props; | ||
925 | struct backlight_device *bd; | 926 | struct backlight_device *bd; |
926 | 927 | ||
927 | bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops); | 928 | memset(&props, 0, sizeof(struct backlight_properties)); |
929 | props.max_brightness = max_brightness; | ||
930 | bd = backlight_device_register("acer-wmi", dev, NULL, &acer_bl_ops, | ||
931 | &props); | ||
928 | if (IS_ERR(bd)) { | 932 | if (IS_ERR(bd)) { |
929 | printk(ACER_ERR "Could not register Acer backlight device\n"); | 933 | printk(ACER_ERR "Could not register Acer backlight device\n"); |
930 | acer_backlight_device = NULL; | 934 | acer_backlight_device = NULL; |
@@ -935,7 +939,6 @@ static int __devinit acer_backlight_init(struct device *dev) | |||
935 | 939 | ||
936 | bd->props.power = FB_BLANK_UNBLANK; | 940 | bd->props.power = FB_BLANK_UNBLANK; |
937 | bd->props.brightness = read_brightness(bd); | 941 | bd->props.brightness = read_brightness(bd); |
938 | bd->props.max_brightness = max_brightness; | ||
939 | backlight_update_status(bd); | 942 | backlight_update_status(bd); |
940 | return 0; | 943 | return 0; |
941 | } | 944 | } |
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index 791fcf321506..db5f7db2ba33 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -639,12 +639,16 @@ static int asus_backlight_init(struct asus_laptop *asus) | |||
639 | { | 639 | { |
640 | struct backlight_device *bd; | 640 | struct backlight_device *bd; |
641 | struct device *dev = &asus->platform_device->dev; | 641 | struct device *dev = &asus->platform_device->dev; |
642 | struct backlight_properties props; | ||
642 | 643 | ||
643 | if (!acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_GET, NULL) && | 644 | if (!acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_GET, NULL) && |
644 | !acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_SET, NULL) && | 645 | !acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_SET, NULL) && |
645 | lcd_switch_handle) { | 646 | lcd_switch_handle) { |
647 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
648 | props.max_brightness = 15; | ||
649 | |||
646 | bd = backlight_device_register(ASUS_LAPTOP_FILE, dev, | 650 | bd = backlight_device_register(ASUS_LAPTOP_FILE, dev, |
647 | asus, &asusbl_ops); | 651 | asus, &asusbl_ops, &props); |
648 | if (IS_ERR(bd)) { | 652 | if (IS_ERR(bd)) { |
649 | pr_err("Could not register asus backlight device\n"); | 653 | pr_err("Could not register asus backlight device\n"); |
650 | asus->backlight_device = NULL; | 654 | asus->backlight_device = NULL; |
@@ -653,7 +657,6 @@ static int asus_backlight_init(struct asus_laptop *asus) | |||
653 | 657 | ||
654 | asus->backlight_device = bd; | 658 | asus->backlight_device = bd; |
655 | 659 | ||
656 | bd->props.max_brightness = 15; | ||
657 | bd->props.power = FB_BLANK_UNBLANK; | 660 | bd->props.power = FB_BLANK_UNBLANK; |
658 | bd->props.brightness = asus_read_brightness(bd); | 661 | bd->props.brightness = asus_read_brightness(bd); |
659 | backlight_update_status(bd); | 662 | backlight_update_status(bd); |
diff --git a/drivers/platform/x86/asus_acpi.c b/drivers/platform/x86/asus_acpi.c index 1381430e1105..ee520357abaa 100644 --- a/drivers/platform/x86/asus_acpi.c +++ b/drivers/platform/x86/asus_acpi.c | |||
@@ -1481,6 +1481,7 @@ static void asus_acpi_exit(void) | |||
1481 | 1481 | ||
1482 | static int __init asus_acpi_init(void) | 1482 | static int __init asus_acpi_init(void) |
1483 | { | 1483 | { |
1484 | struct backlight_properties props; | ||
1484 | int result; | 1485 | int result; |
1485 | 1486 | ||
1486 | result = acpi_bus_register_driver(&asus_hotk_driver); | 1487 | result = acpi_bus_register_driver(&asus_hotk_driver); |
@@ -1507,15 +1508,17 @@ static int __init asus_acpi_init(void) | |||
1507 | return -ENODEV; | 1508 | return -ENODEV; |
1508 | } | 1509 | } |
1509 | 1510 | ||
1511 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
1512 | props.max_brightness = 15; | ||
1510 | asus_backlight_device = backlight_device_register("asus", NULL, NULL, | 1513 | asus_backlight_device = backlight_device_register("asus", NULL, NULL, |
1511 | &asus_backlight_data); | 1514 | &asus_backlight_data, |
1515 | &props); | ||
1512 | if (IS_ERR(asus_backlight_device)) { | 1516 | if (IS_ERR(asus_backlight_device)) { |
1513 | printk(KERN_ERR "Could not register asus backlight device\n"); | 1517 | printk(KERN_ERR "Could not register asus backlight device\n"); |
1514 | asus_backlight_device = NULL; | 1518 | asus_backlight_device = NULL; |
1515 | asus_acpi_exit(); | 1519 | asus_acpi_exit(); |
1516 | return -ENODEV; | 1520 | return -ENODEV; |
1517 | } | 1521 | } |
1518 | asus_backlight_device->props.max_brightness = 15; | ||
1519 | 1522 | ||
1520 | return 0; | 1523 | return 0; |
1521 | } | 1524 | } |
diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c index 035a7dd65a3f..6670ed8f9e5b 100644 --- a/drivers/platform/x86/classmate-laptop.c +++ b/drivers/platform/x86/classmate-laptop.c | |||
@@ -462,11 +462,13 @@ static struct backlight_ops cmpc_bl_ops = { | |||
462 | 462 | ||
463 | static int cmpc_bl_add(struct acpi_device *acpi) | 463 | static int cmpc_bl_add(struct acpi_device *acpi) |
464 | { | 464 | { |
465 | struct backlight_properties props; | ||
465 | struct backlight_device *bd; | 466 | struct backlight_device *bd; |
466 | 467 | ||
467 | bd = backlight_device_register("cmpc_bl", &acpi->dev, | 468 | memset(&props, 0, sizeof(struct backlight_properties)); |
468 | acpi->handle, &cmpc_bl_ops); | 469 | props.max_brightness = 7; |
469 | bd->props.max_brightness = 7; | 470 | bd = backlight_device_register("cmpc_bl", &acpi->dev, acpi->handle, |
471 | &cmpc_bl_ops, &props); | ||
470 | dev_set_drvdata(&acpi->dev, bd); | 472 | dev_set_drvdata(&acpi->dev, bd); |
471 | return 0; | 473 | return 0; |
472 | } | 474 | } |
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c index 2740b40aad9b..71ff1545a93e 100644 --- a/drivers/platform/x86/compal-laptop.c +++ b/drivers/platform/x86/compal-laptop.c | |||
@@ -291,12 +291,15 @@ static int __init compal_init(void) | |||
291 | /* Register backlight stuff */ | 291 | /* Register backlight stuff */ |
292 | 292 | ||
293 | if (!acpi_video_backlight_support()) { | 293 | if (!acpi_video_backlight_support()) { |
294 | compalbl_device = backlight_device_register("compal-laptop", NULL, NULL, | 294 | struct backlight_properties props; |
295 | &compalbl_ops); | 295 | memset(&props, 0, sizeof(struct backlight_properties)); |
296 | props.max_brightness = COMPAL_LCD_LEVEL_MAX - 1; | ||
297 | compalbl_device = backlight_device_register("compal-laptop", | ||
298 | NULL, NULL, | ||
299 | &compalbl_ops, | ||
300 | &props); | ||
296 | if (IS_ERR(compalbl_device)) | 301 | if (IS_ERR(compalbl_device)) |
297 | return PTR_ERR(compalbl_device); | 302 | return PTR_ERR(compalbl_device); |
298 | |||
299 | compalbl_device->props.max_brightness = COMPAL_LCD_LEVEL_MAX-1; | ||
300 | } | 303 | } |
301 | 304 | ||
302 | ret = platform_driver_register(&compal_driver); | 305 | ret = platform_driver_register(&compal_driver); |
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index ef614979afe9..46435ac4684f 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -559,10 +559,14 @@ static int __init dell_init(void) | |||
559 | release_buffer(); | 559 | release_buffer(); |
560 | 560 | ||
561 | if (max_intensity) { | 561 | if (max_intensity) { |
562 | dell_backlight_device = backlight_device_register( | 562 | struct backlight_properties props; |
563 | "dell_backlight", | 563 | memset(&props, 0, sizeof(struct backlight_properties)); |
564 | &platform_device->dev, NULL, | 564 | props.max_brightness = max_intensity; |
565 | &dell_ops); | 565 | dell_backlight_device = backlight_device_register("dell_backlight", |
566 | &platform_device->dev, | ||
567 | NULL, | ||
568 | &dell_ops, | ||
569 | &props); | ||
566 | 570 | ||
567 | if (IS_ERR(dell_backlight_device)) { | 571 | if (IS_ERR(dell_backlight_device)) { |
568 | ret = PTR_ERR(dell_backlight_device); | 572 | ret = PTR_ERR(dell_backlight_device); |
@@ -570,7 +574,6 @@ static int __init dell_init(void) | |||
570 | goto fail_backlight; | 574 | goto fail_backlight; |
571 | } | 575 | } |
572 | 576 | ||
573 | dell_backlight_device->props.max_brightness = max_intensity; | ||
574 | dell_backlight_device->props.brightness = | 577 | dell_backlight_device->props.brightness = |
575 | dell_get_intensity(dell_backlight_device); | 578 | dell_get_intensity(dell_backlight_device); |
576 | backlight_update_status(dell_backlight_device); | 579 | backlight_update_status(dell_backlight_device); |
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c index 9a844caa3756..3fdf21e0052e 100644 --- a/drivers/platform/x86/eeepc-laptop.c +++ b/drivers/platform/x86/eeepc-laptop.c | |||
@@ -1131,18 +1131,20 @@ static int eeepc_backlight_notify(struct eeepc_laptop *eeepc) | |||
1131 | 1131 | ||
1132 | static int eeepc_backlight_init(struct eeepc_laptop *eeepc) | 1132 | static int eeepc_backlight_init(struct eeepc_laptop *eeepc) |
1133 | { | 1133 | { |
1134 | struct backlight_properties props; | ||
1134 | struct backlight_device *bd; | 1135 | struct backlight_device *bd; |
1135 | 1136 | ||
1137 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
1138 | props.max_brightness = 15; | ||
1136 | bd = backlight_device_register(EEEPC_LAPTOP_FILE, | 1139 | bd = backlight_device_register(EEEPC_LAPTOP_FILE, |
1137 | &eeepc->platform_device->dev, | 1140 | &eeepc->platform_device->dev, eeepc, |
1138 | eeepc, &eeepcbl_ops); | 1141 | &eeepcbl_ops, &props); |
1139 | if (IS_ERR(bd)) { | 1142 | if (IS_ERR(bd)) { |
1140 | pr_err("Could not register eeepc backlight device\n"); | 1143 | pr_err("Could not register eeepc backlight device\n"); |
1141 | eeepc->backlight_device = NULL; | 1144 | eeepc->backlight_device = NULL; |
1142 | return PTR_ERR(bd); | 1145 | return PTR_ERR(bd); |
1143 | } | 1146 | } |
1144 | eeepc->backlight_device = bd; | 1147 | eeepc->backlight_device = bd; |
1145 | bd->props.max_brightness = 15; | ||
1146 | bd->props.brightness = read_brightness(bd); | 1148 | bd->props.brightness = read_brightness(bd); |
1147 | bd->props.power = FB_BLANK_UNBLANK; | 1149 | bd->props.power = FB_BLANK_UNBLANK; |
1148 | backlight_update_status(bd); | 1150 | backlight_update_status(bd); |
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 5f3320d468f6..c1074b32490e 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c | |||
@@ -1126,16 +1126,20 @@ static int __init fujitsu_init(void) | |||
1126 | /* Register backlight stuff */ | 1126 | /* Register backlight stuff */ |
1127 | 1127 | ||
1128 | if (!acpi_video_backlight_support()) { | 1128 | if (!acpi_video_backlight_support()) { |
1129 | fujitsu->bl_device = | 1129 | struct backlight_properties props; |
1130 | backlight_device_register("fujitsu-laptop", NULL, NULL, | 1130 | |
1131 | &fujitsubl_ops); | 1131 | memset(&props, 0, sizeof(struct backlight_properties)); |
1132 | max_brightness = fujitsu->max_brightness; | ||
1133 | props.max_brightness = max_brightness - 1; | ||
1134 | fujitsu->bl_device = backlight_device_register("fujitsu-laptop", | ||
1135 | NULL, NULL, | ||
1136 | &fujitsubl_ops, | ||
1137 | &props); | ||
1132 | if (IS_ERR(fujitsu->bl_device)) { | 1138 | if (IS_ERR(fujitsu->bl_device)) { |
1133 | ret = PTR_ERR(fujitsu->bl_device); | 1139 | ret = PTR_ERR(fujitsu->bl_device); |
1134 | fujitsu->bl_device = NULL; | 1140 | fujitsu->bl_device = NULL; |
1135 | goto fail_sysfs_group; | 1141 | goto fail_sysfs_group; |
1136 | } | 1142 | } |
1137 | max_brightness = fujitsu->max_brightness; | ||
1138 | fujitsu->bl_device->props.max_brightness = max_brightness - 1; | ||
1139 | fujitsu->bl_device->props.brightness = fujitsu->brightness_level; | 1143 | fujitsu->bl_device->props.brightness = fujitsu->brightness_level; |
1140 | } | 1144 | } |
1141 | 1145 | ||
diff --git a/drivers/platform/x86/msi-laptop.c b/drivers/platform/x86/msi-laptop.c index c2b05da4289a..996223a7c009 100644 --- a/drivers/platform/x86/msi-laptop.c +++ b/drivers/platform/x86/msi-laptop.c | |||
@@ -683,11 +683,14 @@ static int __init msi_init(void) | |||
683 | printk(KERN_INFO "MSI: Brightness ignored, must be controlled " | 683 | printk(KERN_INFO "MSI: Brightness ignored, must be controlled " |
684 | "by ACPI video driver\n"); | 684 | "by ACPI video driver\n"); |
685 | } else { | 685 | } else { |
686 | struct backlight_properties props; | ||
687 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
688 | props.max_brightness = MSI_LCD_LEVEL_MAX - 1; | ||
686 | msibl_device = backlight_device_register("msi-laptop-bl", NULL, | 689 | msibl_device = backlight_device_register("msi-laptop-bl", NULL, |
687 | NULL, &msibl_ops); | 690 | NULL, &msibl_ops, |
691 | &props); | ||
688 | if (IS_ERR(msibl_device)) | 692 | if (IS_ERR(msibl_device)) |
689 | return PTR_ERR(msibl_device); | 693 | return PTR_ERR(msibl_device); |
690 | msibl_device->props.max_brightness = MSI_LCD_LEVEL_MAX-1; | ||
691 | } | 694 | } |
692 | 695 | ||
693 | ret = platform_driver_register(&msipf_driver); | 696 | ret = platform_driver_register(&msipf_driver); |
diff --git a/drivers/platform/x86/msi-wmi.c b/drivers/platform/x86/msi-wmi.c index f5f70d4c6913..fb7ccaae6563 100644 --- a/drivers/platform/x86/msi-wmi.c +++ b/drivers/platform/x86/msi-wmi.c | |||
@@ -249,12 +249,15 @@ static int __init msi_wmi_init(void) | |||
249 | goto err_uninstall_notifier; | 249 | goto err_uninstall_notifier; |
250 | 250 | ||
251 | if (!acpi_video_backlight_support()) { | 251 | if (!acpi_video_backlight_support()) { |
252 | backlight = backlight_device_register(DRV_NAME, | 252 | struct backlight_properties props; |
253 | NULL, NULL, &msi_backlight_ops); | 253 | memset(&props, 0, sizeof(struct backlight_properties)); |
254 | props.max_brightness = ARRAY_SIZE(backlight_map) - 1; | ||
255 | backlight = backlight_device_register(DRV_NAME, NULL, NULL, | ||
256 | &msi_backlight_ops, | ||
257 | &props); | ||
254 | if (IS_ERR(backlight)) | 258 | if (IS_ERR(backlight)) |
255 | goto err_free_input; | 259 | goto err_free_input; |
256 | 260 | ||
257 | backlight->props.max_brightness = ARRAY_SIZE(backlight_map) - 1; | ||
258 | err = bl_get(NULL); | 261 | err = bl_get(NULL); |
259 | if (err < 0) | 262 | if (err < 0) |
260 | goto err_free_backlight; | 263 | goto err_free_backlight; |
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index c9fc479fc290..ab5c9cea1462 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c | |||
@@ -600,6 +600,7 @@ static int acpi_pcc_hotkey_resume(struct acpi_device *device) | |||
600 | 600 | ||
601 | static int acpi_pcc_hotkey_add(struct acpi_device *device) | 601 | static int acpi_pcc_hotkey_add(struct acpi_device *device) |
602 | { | 602 | { |
603 | struct backlight_properties props; | ||
603 | struct pcc_acpi *pcc; | 604 | struct pcc_acpi *pcc; |
604 | int num_sifr, result; | 605 | int num_sifr, result; |
605 | 606 | ||
@@ -637,24 +638,23 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
637 | if (result) { | 638 | if (result) { |
638 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 639 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
639 | "Error installing keyinput handler\n")); | 640 | "Error installing keyinput handler\n")); |
640 | goto out_sinf; | 641 | goto out_hotkey; |
641 | } | 642 | } |
642 | 643 | ||
643 | /* initialize backlight */ | ||
644 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, | ||
645 | &pcc_backlight_ops); | ||
646 | if (IS_ERR(pcc->backlight)) | ||
647 | goto out_input; | ||
648 | |||
649 | if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { | 644 | if (!acpi_pcc_retrieve_biosdata(pcc, pcc->sinf)) { |
650 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 645 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
651 | "Couldn't retrieve BIOS data\n")); | 646 | "Couldn't retrieve BIOS data\n")); |
652 | goto out_backlight; | 647 | goto out_input; |
653 | } | 648 | } |
649 | /* initialize backlight */ | ||
650 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
651 | props.max_brightness = pcc->sinf[SINF_AC_MAX_BRIGHT]; | ||
652 | pcc->backlight = backlight_device_register("panasonic", NULL, pcc, | ||
653 | &pcc_backlight_ops, &props); | ||
654 | if (IS_ERR(pcc->backlight)) | ||
655 | goto out_sinf; | ||
654 | 656 | ||
655 | /* read the initial brightness setting from the hardware */ | 657 | /* read the initial brightness setting from the hardware */ |
656 | pcc->backlight->props.max_brightness = | ||
657 | pcc->sinf[SINF_AC_MAX_BRIGHT]; | ||
658 | pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; | 658 | pcc->backlight->props.brightness = pcc->sinf[SINF_AC_CUR_BRIGHT]; |
659 | 659 | ||
660 | /* read the initial sticky key mode from the hardware */ | 660 | /* read the initial sticky key mode from the hardware */ |
@@ -669,12 +669,12 @@ static int acpi_pcc_hotkey_add(struct acpi_device *device) | |||
669 | 669 | ||
670 | out_backlight: | 670 | out_backlight: |
671 | backlight_device_unregister(pcc->backlight); | 671 | backlight_device_unregister(pcc->backlight); |
672 | out_sinf: | ||
673 | kfree(pcc->sinf); | ||
672 | out_input: | 674 | out_input: |
673 | input_unregister_device(pcc->input_dev); | 675 | input_unregister_device(pcc->input_dev); |
674 | /* no need to input_free_device() since core input API refcount and | 676 | /* no need to input_free_device() since core input API refcount and |
675 | * free()s the device */ | 677 | * free()s the device */ |
676 | out_sinf: | ||
677 | kfree(pcc->sinf); | ||
678 | out_hotkey: | 678 | out_hotkey: |
679 | kfree(pcc); | 679 | kfree(pcc); |
680 | 680 | ||
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c index 5a3d8514c66d..6553b91caaa4 100644 --- a/drivers/platform/x86/sony-laptop.c +++ b/drivers/platform/x86/sony-laptop.c | |||
@@ -1291,9 +1291,13 @@ static int sony_nc_add(struct acpi_device *device) | |||
1291 | "controlled by ACPI video driver\n"); | 1291 | "controlled by ACPI video driver\n"); |
1292 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", | 1292 | } else if (ACPI_SUCCESS(acpi_get_handle(sony_nc_acpi_handle, "GBRT", |
1293 | &handle))) { | 1293 | &handle))) { |
1294 | struct backlight_properties props; | ||
1295 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
1296 | props.max_brightness = SONY_MAX_BRIGHTNESS - 1; | ||
1294 | sony_backlight_device = backlight_device_register("sony", NULL, | 1297 | sony_backlight_device = backlight_device_register("sony", NULL, |
1295 | NULL, | 1298 | NULL, |
1296 | &sony_backlight_ops); | 1299 | &sony_backlight_ops, |
1300 | &props); | ||
1297 | 1301 | ||
1298 | if (IS_ERR(sony_backlight_device)) { | 1302 | if (IS_ERR(sony_backlight_device)) { |
1299 | printk(KERN_WARNING DRV_PFX "unable to register backlight device\n"); | 1303 | printk(KERN_WARNING DRV_PFX "unable to register backlight device\n"); |
@@ -1302,8 +1306,6 @@ static int sony_nc_add(struct acpi_device *device) | |||
1302 | sony_backlight_device->props.brightness = | 1306 | sony_backlight_device->props.brightness = |
1303 | sony_backlight_get_brightness | 1307 | sony_backlight_get_brightness |
1304 | (sony_backlight_device); | 1308 | (sony_backlight_device); |
1305 | sony_backlight_device->props.max_brightness = | ||
1306 | SONY_MAX_BRIGHTNESS - 1; | ||
1307 | } | 1309 | } |
1308 | 1310 | ||
1309 | } | 1311 | } |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index c64e3528889b..770b85327f84 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -6170,6 +6170,7 @@ static const struct tpacpi_quirk brightness_quirk_table[] __initconst = { | |||
6170 | 6170 | ||
6171 | static int __init brightness_init(struct ibm_init_struct *iibm) | 6171 | static int __init brightness_init(struct ibm_init_struct *iibm) |
6172 | { | 6172 | { |
6173 | struct backlight_properties props; | ||
6173 | int b; | 6174 | int b; |
6174 | unsigned long quirks; | 6175 | unsigned long quirks; |
6175 | 6176 | ||
@@ -6259,9 +6260,12 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
6259 | printk(TPACPI_INFO | 6260 | printk(TPACPI_INFO |
6260 | "detected a 16-level brightness capable ThinkPad\n"); | 6261 | "detected a 16-level brightness capable ThinkPad\n"); |
6261 | 6262 | ||
6262 | ibm_backlight_device = backlight_device_register( | 6263 | memset(&props, 0, sizeof(struct backlight_properties)); |
6263 | TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, | 6264 | props.max_brightness = (tp_features.bright_16levels) ? 15 : 7; |
6264 | &ibm_backlight_data); | 6265 | ibm_backlight_device = backlight_device_register(TPACPI_BACKLIGHT_DEV_NAME, |
6266 | NULL, NULL, | ||
6267 | &ibm_backlight_data, | ||
6268 | &props); | ||
6265 | if (IS_ERR(ibm_backlight_device)) { | 6269 | if (IS_ERR(ibm_backlight_device)) { |
6266 | int rc = PTR_ERR(ibm_backlight_device); | 6270 | int rc = PTR_ERR(ibm_backlight_device); |
6267 | ibm_backlight_device = NULL; | 6271 | ibm_backlight_device = NULL; |
@@ -6280,8 +6284,6 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
6280 | "or not on your ThinkPad\n", TPACPI_MAIL); | 6284 | "or not on your ThinkPad\n", TPACPI_MAIL); |
6281 | } | 6285 | } |
6282 | 6286 | ||
6283 | ibm_backlight_device->props.max_brightness = | ||
6284 | (tp_features.bright_16levels)? 15 : 7; | ||
6285 | ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; | 6287 | ibm_backlight_device->props.brightness = b & TP_EC_BACKLIGHT_LVLMSK; |
6286 | backlight_update_status(ibm_backlight_device); | 6288 | backlight_update_status(ibm_backlight_device); |
6287 | 6289 | ||
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 789240d1b577..def4841183be 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c | |||
@@ -924,6 +924,7 @@ static int __init toshiba_acpi_init(void) | |||
924 | u32 hci_result; | 924 | u32 hci_result; |
925 | bool bt_present; | 925 | bool bt_present; |
926 | int ret = 0; | 926 | int ret = 0; |
927 | struct backlight_properties props; | ||
927 | 928 | ||
928 | if (acpi_disabled) | 929 | if (acpi_disabled) |
929 | return -ENODEV; | 930 | return -ENODEV; |
@@ -974,10 +975,12 @@ static int __init toshiba_acpi_init(void) | |||
974 | } | 975 | } |
975 | } | 976 | } |
976 | 977 | ||
978 | props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; | ||
977 | toshiba_backlight_device = backlight_device_register("toshiba", | 979 | toshiba_backlight_device = backlight_device_register("toshiba", |
978 | &toshiba_acpi.p_dev->dev, | 980 | &toshiba_acpi.p_dev->dev, |
979 | NULL, | 981 | NULL, |
980 | &toshiba_backlight_data); | 982 | &toshiba_backlight_data, |
983 | &props); | ||
981 | if (IS_ERR(toshiba_backlight_device)) { | 984 | if (IS_ERR(toshiba_backlight_device)) { |
982 | ret = PTR_ERR(toshiba_backlight_device); | 985 | ret = PTR_ERR(toshiba_backlight_device); |
983 | 986 | ||
@@ -986,7 +989,6 @@ static int __init toshiba_acpi_init(void) | |||
986 | toshiba_acpi_exit(); | 989 | toshiba_acpi_exit(); |
987 | return ret; | 990 | return ret; |
988 | } | 991 | } |
989 | toshiba_backlight_device->props.max_brightness = HCI_LCD_BRIGHTNESS_LEVELS - 1; | ||
990 | 992 | ||
991 | /* Register rfkill switch for Bluetooth */ | 993 | /* Register rfkill switch for Bluetooth */ |
992 | if (hci_get_bt_present(&bt_present) == HCI_SUCCESS && bt_present) { | 994 | if (hci_get_bt_present(&bt_present) == HCI_SUCCESS && bt_present) { |