diff options
-rw-r--r-- | drivers/platform/x86/Kconfig | 3 | ||||
-rw-r--r-- | drivers/platform/x86/amilo-rfkill.c | 7 | ||||
-rw-r--r-- | drivers/platform/x86/classmate-laptop.c | 2 | ||||
-rw-r--r-- | drivers/platform/x86/compal-laptop.c | 7 | ||||
-rw-r--r-- | drivers/platform/x86/hp-wmi.c | 16 | ||||
-rw-r--r-- | drivers/platform/x86/intel-rst.c | 13 | ||||
-rw-r--r-- | drivers/platform/x86/intel-smartconnect.c | 13 | ||||
-rw-r--r-- | drivers/platform/x86/intel_mid_powerbtn.c | 1 | ||||
-rw-r--r-- | drivers/platform/x86/intel_mid_thermal.c | 1 | ||||
-rw-r--r-- | drivers/platform/x86/panasonic-laptop.c | 25 | ||||
-rw-r--r-- | drivers/platform/x86/samsung-q10.c | 65 | ||||
-rw-r--r-- | drivers/platform/x86/thinkpad_acpi.c | 23 | ||||
-rw-r--r-- | drivers/platform/x86/wmi.c | 4 |
13 files changed, 66 insertions, 114 deletions
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 36a9e6023395..96d6b2eef4f2 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -732,6 +732,7 @@ config SAMSUNG_LAPTOP | |||
732 | tristate "Samsung Laptop driver" | 732 | tristate "Samsung Laptop driver" |
733 | depends on X86 | 733 | depends on X86 |
734 | depends on RFKILL || RFKILL = n | 734 | depends on RFKILL || RFKILL = n |
735 | depends on ACPI_VIDEO || ACPI_VIDEO = n | ||
735 | depends on BACKLIGHT_CLASS_DEVICE | 736 | depends on BACKLIGHT_CLASS_DEVICE |
736 | select LEDS_CLASS | 737 | select LEDS_CLASS |
737 | select NEW_LEDS | 738 | select NEW_LEDS |
@@ -764,7 +765,7 @@ config INTEL_OAKTRAIL | |||
764 | 765 | ||
765 | config SAMSUNG_Q10 | 766 | config SAMSUNG_Q10 |
766 | tristate "Samsung Q10 Extras" | 767 | tristate "Samsung Q10 Extras" |
767 | depends on SERIO_I8042 | 768 | depends on ACPI |
768 | select BACKLIGHT_CLASS_DEVICE | 769 | select BACKLIGHT_CLASS_DEVICE |
769 | ---help--- | 770 | ---help--- |
770 | This driver provides support for backlight control on Samsung Q10 | 771 | This driver provides support for backlight control on Samsung Q10 |
diff --git a/drivers/platform/x86/amilo-rfkill.c b/drivers/platform/x86/amilo-rfkill.c index 6296f078b7bc..da36b5e824d4 100644 --- a/drivers/platform/x86/amilo-rfkill.c +++ b/drivers/platform/x86/amilo-rfkill.c | |||
@@ -85,6 +85,13 @@ static const struct dmi_system_id amilo_rfkill_id_table[] = { | |||
85 | { | 85 | { |
86 | .matches = { | 86 | .matches = { |
87 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | 87 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), |
88 | DMI_MATCH(DMI_BOARD_NAME, "AMILO L1310"), | ||
89 | }, | ||
90 | .driver_data = (void *)&amilo_a1655_rfkill_ops | ||
91 | }, | ||
92 | { | ||
93 | .matches = { | ||
94 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
88 | DMI_MATCH(DMI_BOARD_NAME, "AMILO M7440"), | 95 | DMI_MATCH(DMI_BOARD_NAME, "AMILO M7440"), |
89 | }, | 96 | }, |
90 | .driver_data = (void *)&amilo_m7440_rfkill_ops | 97 | .driver_data = (void *)&amilo_m7440_rfkill_ops |
diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c index 36e5e6c13db4..6dfa8d3b4eec 100644 --- a/drivers/platform/x86/classmate-laptop.c +++ b/drivers/platform/x86/classmate-laptop.c | |||
@@ -590,7 +590,7 @@ static ssize_t cmpc_accel_sensitivity_store(struct device *dev, | |||
590 | inputdev = dev_get_drvdata(&acpi->dev); | 590 | inputdev = dev_get_drvdata(&acpi->dev); |
591 | accel = dev_get_drvdata(&inputdev->dev); | 591 | accel = dev_get_drvdata(&inputdev->dev); |
592 | 592 | ||
593 | r = strict_strtoul(buf, 0, &sensitivity); | 593 | r = kstrtoul(buf, 0, &sensitivity); |
594 | if (r) | 594 | if (r) |
595 | return r; | 595 | return r; |
596 | 596 | ||
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c index 475cc5242511..eaa78edb1f4e 100644 --- a/drivers/platform/x86/compal-laptop.c +++ b/drivers/platform/x86/compal-laptop.c | |||
@@ -425,7 +425,8 @@ static ssize_t pwm_enable_store(struct device *dev, | |||
425 | struct compal_data *data = dev_get_drvdata(dev); | 425 | struct compal_data *data = dev_get_drvdata(dev); |
426 | long val; | 426 | long val; |
427 | int err; | 427 | int err; |
428 | err = strict_strtol(buf, 10, &val); | 428 | |
429 | err = kstrtol(buf, 10, &val); | ||
429 | if (err) | 430 | if (err) |
430 | return err; | 431 | return err; |
431 | if (val < 0) | 432 | if (val < 0) |
@@ -463,7 +464,8 @@ static ssize_t pwm_store(struct device *dev, struct device_attribute *attr, | |||
463 | struct compal_data *data = dev_get_drvdata(dev); | 464 | struct compal_data *data = dev_get_drvdata(dev); |
464 | long val; | 465 | long val; |
465 | int err; | 466 | int err; |
466 | err = strict_strtol(buf, 10, &val); | 467 | |
468 | err = kstrtol(buf, 10, &val); | ||
467 | if (err) | 469 | if (err) |
468 | return err; | 470 | return err; |
469 | if (val < 0 || val > 255) | 471 | if (val < 0 || val > 255) |
@@ -1081,7 +1083,6 @@ static int compal_remove(struct platform_device *pdev) | |||
1081 | hwmon_device_unregister(data->hwmon_dev); | 1083 | hwmon_device_unregister(data->hwmon_dev); |
1082 | power_supply_unregister(&data->psy); | 1084 | power_supply_unregister(&data->psy); |
1083 | 1085 | ||
1084 | platform_set_drvdata(pdev, NULL); | ||
1085 | kfree(data); | 1086 | kfree(data); |
1086 | 1087 | ||
1087 | sysfs_remove_group(&pdev->dev.kobj, &compal_attribute_group); | 1088 | sysfs_remove_group(&pdev->dev.kobj, &compal_attribute_group); |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index d6970f47ae72..1c86fa0857c8 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -725,7 +725,7 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) | |||
725 | (void *) HPWMI_WWAN); | 725 | (void *) HPWMI_WWAN); |
726 | if (!wwan_rfkill) { | 726 | if (!wwan_rfkill) { |
727 | err = -ENOMEM; | 727 | err = -ENOMEM; |
728 | goto register_gps_error; | 728 | goto register_bluetooth_error; |
729 | } | 729 | } |
730 | rfkill_init_sw_state(wwan_rfkill, | 730 | rfkill_init_sw_state(wwan_rfkill, |
731 | hp_wmi_get_sw_state(HPWMI_WWAN)); | 731 | hp_wmi_get_sw_state(HPWMI_WWAN)); |
@@ -733,7 +733,7 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) | |||
733 | hp_wmi_get_hw_state(HPWMI_WWAN)); | 733 | hp_wmi_get_hw_state(HPWMI_WWAN)); |
734 | err = rfkill_register(wwan_rfkill); | 734 | err = rfkill_register(wwan_rfkill); |
735 | if (err) | 735 | if (err) |
736 | goto register_wwan_err; | 736 | goto register_wwan_error; |
737 | } | 737 | } |
738 | 738 | ||
739 | if (wireless & 0x8) { | 739 | if (wireless & 0x8) { |
@@ -743,7 +743,7 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) | |||
743 | (void *) HPWMI_GPS); | 743 | (void *) HPWMI_GPS); |
744 | if (!gps_rfkill) { | 744 | if (!gps_rfkill) { |
745 | err = -ENOMEM; | 745 | err = -ENOMEM; |
746 | goto register_bluetooth_error; | 746 | goto register_wwan_error; |
747 | } | 747 | } |
748 | rfkill_init_sw_state(gps_rfkill, | 748 | rfkill_init_sw_state(gps_rfkill, |
749 | hp_wmi_get_sw_state(HPWMI_GPS)); | 749 | hp_wmi_get_sw_state(HPWMI_GPS)); |
@@ -755,16 +755,16 @@ static int hp_wmi_rfkill_setup(struct platform_device *device) | |||
755 | } | 755 | } |
756 | 756 | ||
757 | return 0; | 757 | return 0; |
758 | register_wwan_err: | ||
759 | rfkill_destroy(wwan_rfkill); | ||
760 | wwan_rfkill = NULL; | ||
761 | if (gps_rfkill) | ||
762 | rfkill_unregister(gps_rfkill); | ||
763 | register_gps_error: | 758 | register_gps_error: |
764 | rfkill_destroy(gps_rfkill); | 759 | rfkill_destroy(gps_rfkill); |
765 | gps_rfkill = NULL; | 760 | gps_rfkill = NULL; |
766 | if (bluetooth_rfkill) | 761 | if (bluetooth_rfkill) |
767 | rfkill_unregister(bluetooth_rfkill); | 762 | rfkill_unregister(bluetooth_rfkill); |
763 | register_wwan_error: | ||
764 | rfkill_destroy(wwan_rfkill); | ||
765 | wwan_rfkill = NULL; | ||
766 | if (gps_rfkill) | ||
767 | rfkill_unregister(gps_rfkill); | ||
768 | register_bluetooth_error: | 768 | register_bluetooth_error: |
769 | rfkill_destroy(bluetooth_rfkill); | 769 | rfkill_destroy(bluetooth_rfkill); |
770 | bluetooth_rfkill = NULL; | 770 | bluetooth_rfkill = NULL; |
diff --git a/drivers/platform/x86/intel-rst.c b/drivers/platform/x86/intel-rst.c index 9385afd9b558..41b740cb28bc 100644 --- a/drivers/platform/x86/intel-rst.c +++ b/drivers/platform/x86/intel-rst.c | |||
@@ -193,17 +193,6 @@ static struct acpi_driver irst_driver = { | |||
193 | }, | 193 | }, |
194 | }; | 194 | }; |
195 | 195 | ||
196 | static int irst_init(void) | 196 | module_acpi_driver(irst_driver); |
197 | { | ||
198 | return acpi_bus_register_driver(&irst_driver); | ||
199 | } | ||
200 | |||
201 | static void irst_exit(void) | ||
202 | { | ||
203 | acpi_bus_unregister_driver(&irst_driver); | ||
204 | } | ||
205 | |||
206 | module_init(irst_init); | ||
207 | module_exit(irst_exit); | ||
208 | 197 | ||
209 | MODULE_DEVICE_TABLE(acpi, irst_ids); | 198 | MODULE_DEVICE_TABLE(acpi, irst_ids); |
diff --git a/drivers/platform/x86/intel-smartconnect.c b/drivers/platform/x86/intel-smartconnect.c index f74e93d096bc..52259dcabecb 100644 --- a/drivers/platform/x86/intel-smartconnect.c +++ b/drivers/platform/x86/intel-smartconnect.c | |||
@@ -74,17 +74,6 @@ static struct acpi_driver smartconnect_driver = { | |||
74 | }, | 74 | }, |
75 | }; | 75 | }; |
76 | 76 | ||
77 | static int smartconnect_init(void) | 77 | module_acpi_driver(smartconnect_driver); |
78 | { | ||
79 | return acpi_bus_register_driver(&smartconnect_driver); | ||
80 | } | ||
81 | |||
82 | static void smartconnect_exit(void) | ||
83 | { | ||
84 | acpi_bus_unregister_driver(&smartconnect_driver); | ||
85 | } | ||
86 | |||
87 | module_init(smartconnect_init); | ||
88 | module_exit(smartconnect_exit); | ||
89 | 78 | ||
90 | MODULE_DEVICE_TABLE(acpi, smartconnect_ids); | 79 | MODULE_DEVICE_TABLE(acpi, smartconnect_ids); |
diff --git a/drivers/platform/x86/intel_mid_powerbtn.c b/drivers/platform/x86/intel_mid_powerbtn.c index f59683aa13d5..6b18aba82cfa 100644 --- a/drivers/platform/x86/intel_mid_powerbtn.c +++ b/drivers/platform/x86/intel_mid_powerbtn.c | |||
@@ -128,7 +128,6 @@ static int mfld_pb_remove(struct platform_device *pdev) | |||
128 | 128 | ||
129 | free_irq(irq, input); | 129 | free_irq(irq, input); |
130 | input_unregister_device(input); | 130 | input_unregister_device(input); |
131 | platform_set_drvdata(pdev, NULL); | ||
132 | 131 | ||
133 | return 0; | 132 | return 0; |
134 | } | 133 | } |
diff --git a/drivers/platform/x86/intel_mid_thermal.c b/drivers/platform/x86/intel_mid_thermal.c index 81c491e74b34..93fab8b70ce1 100644 --- a/drivers/platform/x86/intel_mid_thermal.c +++ b/drivers/platform/x86/intel_mid_thermal.c | |||
@@ -542,7 +542,6 @@ static int mid_thermal_remove(struct platform_device *pdev) | |||
542 | } | 542 | } |
543 | 543 | ||
544 | kfree(pinfo); | 544 | kfree(pinfo); |
545 | platform_set_drvdata(pdev, NULL); | ||
546 | 545 | ||
547 | /* Stop the ADC */ | 546 | /* Stop the ADC */ |
548 | return configure_adc(0); | 547 | return configure_adc(0); |
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c index 984253da365d..10d12b221601 100644 --- a/drivers/platform/x86/panasonic-laptop.c +++ b/drivers/platform/x86/panasonic-laptop.c | |||
@@ -643,23 +643,6 @@ out_hotkey: | |||
643 | return result; | 643 | return result; |
644 | } | 644 | } |
645 | 645 | ||
646 | static int __init acpi_pcc_init(void) | ||
647 | { | ||
648 | int result = 0; | ||
649 | |||
650 | if (acpi_disabled) | ||
651 | return -ENODEV; | ||
652 | |||
653 | result = acpi_bus_register_driver(&acpi_pcc_driver); | ||
654 | if (result < 0) { | ||
655 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
656 | "Error registering hotkey driver\n")); | ||
657 | return -ENODEV; | ||
658 | } | ||
659 | |||
660 | return 0; | ||
661 | } | ||
662 | |||
663 | static int acpi_pcc_hotkey_remove(struct acpi_device *device) | 646 | static int acpi_pcc_hotkey_remove(struct acpi_device *device) |
664 | { | 647 | { |
665 | struct pcc_acpi *pcc = acpi_driver_data(device); | 648 | struct pcc_acpi *pcc = acpi_driver_data(device); |
@@ -679,10 +662,4 @@ static int acpi_pcc_hotkey_remove(struct acpi_device *device) | |||
679 | return 0; | 662 | return 0; |
680 | } | 663 | } |
681 | 664 | ||
682 | static void __exit acpi_pcc_exit(void) | 665 | module_acpi_driver(acpi_pcc_driver); |
683 | { | ||
684 | acpi_bus_unregister_driver(&acpi_pcc_driver); | ||
685 | } | ||
686 | |||
687 | module_init(acpi_pcc_init); | ||
688 | module_exit(acpi_pcc_exit); | ||
diff --git a/drivers/platform/x86/samsung-q10.c b/drivers/platform/x86/samsung-q10.c index 4430b8c1369d..cae7098e9b0d 100644 --- a/drivers/platform/x86/samsung-q10.c +++ b/drivers/platform/x86/samsung-q10.c | |||
@@ -14,16 +14,12 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/backlight.h> | 16 | #include <linux/backlight.h> |
17 | #include <linux/i8042.h> | ||
18 | #include <linux/dmi.h> | 17 | #include <linux/dmi.h> |
18 | #include <acpi/acpi_drivers.h> | ||
19 | 19 | ||
20 | #define SAMSUNGQ10_BL_MAX_INTENSITY 255 | 20 | #define SAMSUNGQ10_BL_MAX_INTENSITY 7 |
21 | #define SAMSUNGQ10_BL_DEFAULT_INTENSITY 185 | ||
22 | 21 | ||
23 | #define SAMSUNGQ10_BL_8042_CMD 0xbe | 22 | static acpi_handle ec_handle; |
24 | #define SAMSUNGQ10_BL_8042_DATA { 0x89, 0x91 } | ||
25 | |||
26 | static int samsungq10_bl_brightness; | ||
27 | 23 | ||
28 | static bool force; | 24 | static bool force; |
29 | module_param(force, bool, 0); | 25 | module_param(force, bool, 0); |
@@ -33,21 +29,26 @@ MODULE_PARM_DESC(force, | |||
33 | static int samsungq10_bl_set_intensity(struct backlight_device *bd) | 29 | static int samsungq10_bl_set_intensity(struct backlight_device *bd) |
34 | { | 30 | { |
35 | 31 | ||
36 | int brightness = bd->props.brightness; | 32 | acpi_status status; |
37 | unsigned char c[3] = SAMSUNGQ10_BL_8042_DATA; | 33 | int i; |
38 | 34 | ||
39 | c[2] = (unsigned char)brightness; | 35 | for (i = 0; i < SAMSUNGQ10_BL_MAX_INTENSITY; i++) { |
40 | i8042_lock_chip(); | 36 | status = acpi_evaluate_object(ec_handle, "_Q63", NULL, NULL); |
41 | i8042_command(c, (0x30 << 8) | SAMSUNGQ10_BL_8042_CMD); | 37 | if (ACPI_FAILURE(status)) |
42 | i8042_unlock_chip(); | 38 | return -EIO; |
43 | samsungq10_bl_brightness = brightness; | 39 | } |
40 | for (i = 0; i < bd->props.brightness; i++) { | ||
41 | status = acpi_evaluate_object(ec_handle, "_Q64", NULL, NULL); | ||
42 | if (ACPI_FAILURE(status)) | ||
43 | return -EIO; | ||
44 | } | ||
44 | 45 | ||
45 | return 0; | 46 | return 0; |
46 | } | 47 | } |
47 | 48 | ||
48 | static int samsungq10_bl_get_intensity(struct backlight_device *bd) | 49 | static int samsungq10_bl_get_intensity(struct backlight_device *bd) |
49 | { | 50 | { |
50 | return samsungq10_bl_brightness; | 51 | return bd->props.brightness; |
51 | } | 52 | } |
52 | 53 | ||
53 | static const struct backlight_ops samsungq10_bl_ops = { | 54 | static const struct backlight_ops samsungq10_bl_ops = { |
@@ -55,28 +56,6 @@ static const struct backlight_ops samsungq10_bl_ops = { | |||
55 | .update_status = samsungq10_bl_set_intensity, | 56 | .update_status = samsungq10_bl_set_intensity, |
56 | }; | 57 | }; |
57 | 58 | ||
58 | #ifdef CONFIG_PM_SLEEP | ||
59 | static int samsungq10_suspend(struct device *dev) | ||
60 | { | ||
61 | return 0; | ||
62 | } | ||
63 | |||
64 | static int samsungq10_resume(struct device *dev) | ||
65 | { | ||
66 | |||
67 | struct backlight_device *bd = dev_get_drvdata(dev); | ||
68 | |||
69 | samsungq10_bl_set_intensity(bd); | ||
70 | return 0; | ||
71 | } | ||
72 | #else | ||
73 | #define samsungq10_suspend NULL | ||
74 | #define samsungq10_resume NULL | ||
75 | #endif | ||
76 | |||
77 | static SIMPLE_DEV_PM_OPS(samsungq10_pm_ops, | ||
78 | samsungq10_suspend, samsungq10_resume); | ||
79 | |||
80 | static int samsungq10_probe(struct platform_device *pdev) | 59 | static int samsungq10_probe(struct platform_device *pdev) |
81 | { | 60 | { |
82 | 61 | ||
@@ -93,9 +72,6 @@ static int samsungq10_probe(struct platform_device *pdev) | |||
93 | 72 | ||
94 | platform_set_drvdata(pdev, bd); | 73 | platform_set_drvdata(pdev, bd); |
95 | 74 | ||
96 | bd->props.brightness = SAMSUNGQ10_BL_DEFAULT_INTENSITY; | ||
97 | samsungq10_bl_set_intensity(bd); | ||
98 | |||
99 | return 0; | 75 | return 0; |
100 | } | 76 | } |
101 | 77 | ||
@@ -104,9 +80,6 @@ static int samsungq10_remove(struct platform_device *pdev) | |||
104 | 80 | ||
105 | struct backlight_device *bd = platform_get_drvdata(pdev); | 81 | struct backlight_device *bd = platform_get_drvdata(pdev); |
106 | 82 | ||
107 | bd->props.brightness = SAMSUNGQ10_BL_DEFAULT_INTENSITY; | ||
108 | samsungq10_bl_set_intensity(bd); | ||
109 | |||
110 | backlight_device_unregister(bd); | 83 | backlight_device_unregister(bd); |
111 | 84 | ||
112 | return 0; | 85 | return 0; |
@@ -116,7 +89,6 @@ static struct platform_driver samsungq10_driver = { | |||
116 | .driver = { | 89 | .driver = { |
117 | .name = KBUILD_MODNAME, | 90 | .name = KBUILD_MODNAME, |
118 | .owner = THIS_MODULE, | 91 | .owner = THIS_MODULE, |
119 | .pm = &samsungq10_pm_ops, | ||
120 | }, | 92 | }, |
121 | .probe = samsungq10_probe, | 93 | .probe = samsungq10_probe, |
122 | .remove = samsungq10_remove, | 94 | .remove = samsungq10_remove, |
@@ -172,6 +144,11 @@ static int __init samsungq10_init(void) | |||
172 | if (!force && !dmi_check_system(samsungq10_dmi_table)) | 144 | if (!force && !dmi_check_system(samsungq10_dmi_table)) |
173 | return -ENODEV; | 145 | return -ENODEV; |
174 | 146 | ||
147 | ec_handle = ec_get_handle(); | ||
148 | |||
149 | if (!ec_handle) | ||
150 | return -ENODEV; | ||
151 | |||
175 | samsungq10_device = platform_create_bundle(&samsungq10_driver, | 152 | samsungq10_device = platform_create_bundle(&samsungq10_driver, |
176 | samsungq10_probe, | 153 | samsungq10_probe, |
177 | NULL, 0, NULL, 0); | 154 | NULL, 0, NULL, 0); |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index be67e5e28d18..03ca6c139f1a 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -369,7 +369,7 @@ struct tpacpi_led_classdev { | |||
369 | struct led_classdev led_classdev; | 369 | struct led_classdev led_classdev; |
370 | struct work_struct work; | 370 | struct work_struct work; |
371 | enum led_status_t new_state; | 371 | enum led_status_t new_state; |
372 | unsigned int led; | 372 | int led; |
373 | }; | 373 | }; |
374 | 374 | ||
375 | /* brightness level capabilities */ | 375 | /* brightness level capabilities */ |
@@ -5296,6 +5296,16 @@ static int __init led_init(struct ibm_init_struct *iibm) | |||
5296 | 5296 | ||
5297 | led_supported = led_init_detect_mode(); | 5297 | led_supported = led_init_detect_mode(); |
5298 | 5298 | ||
5299 | if (led_supported != TPACPI_LED_NONE) { | ||
5300 | useful_leds = tpacpi_check_quirks(led_useful_qtable, | ||
5301 | ARRAY_SIZE(led_useful_qtable)); | ||
5302 | |||
5303 | if (!useful_leds) { | ||
5304 | led_handle = NULL; | ||
5305 | led_supported = TPACPI_LED_NONE; | ||
5306 | } | ||
5307 | } | ||
5308 | |||
5299 | vdbg_printk(TPACPI_DBG_INIT, "LED commands are %s, mode %d\n", | 5309 | vdbg_printk(TPACPI_DBG_INIT, "LED commands are %s, mode %d\n", |
5300 | str_supported(led_supported), led_supported); | 5310 | str_supported(led_supported), led_supported); |
5301 | 5311 | ||
@@ -5309,10 +5319,9 @@ static int __init led_init(struct ibm_init_struct *iibm) | |||
5309 | return -ENOMEM; | 5319 | return -ENOMEM; |
5310 | } | 5320 | } |
5311 | 5321 | ||
5312 | useful_leds = tpacpi_check_quirks(led_useful_qtable, | ||
5313 | ARRAY_SIZE(led_useful_qtable)); | ||
5314 | |||
5315 | for (i = 0; i < TPACPI_LED_NUMLEDS; i++) { | 5322 | for (i = 0; i < TPACPI_LED_NUMLEDS; i++) { |
5323 | tpacpi_leds[i].led = -1; | ||
5324 | |||
5316 | if (!tpacpi_is_led_restricted(i) && | 5325 | if (!tpacpi_is_led_restricted(i) && |
5317 | test_bit(i, &useful_leds)) { | 5326 | test_bit(i, &useful_leds)) { |
5318 | rc = tpacpi_init_led(i); | 5327 | rc = tpacpi_init_led(i); |
@@ -5370,9 +5379,13 @@ static int led_write(char *buf) | |||
5370 | return -ENODEV; | 5379 | return -ENODEV; |
5371 | 5380 | ||
5372 | while ((cmd = next_cmd(&buf))) { | 5381 | while ((cmd = next_cmd(&buf))) { |
5373 | if (sscanf(cmd, "%d", &led) != 1 || led < 0 || led > 15) | 5382 | if (sscanf(cmd, "%d", &led) != 1) |
5374 | return -EINVAL; | 5383 | return -EINVAL; |
5375 | 5384 | ||
5385 | if (led < 0 || led > (TPACPI_LED_NUMLEDS - 1) || | ||
5386 | tpacpi_leds[led].led < 0) | ||
5387 | return -ENODEV; | ||
5388 | |||
5376 | if (strstr(cmd, "off")) { | 5389 | if (strstr(cmd, "off")) { |
5377 | s = TPACPI_LED_OFF; | 5390 | s = TPACPI_LED_OFF; |
5378 | } else if (strstr(cmd, "on")) { | 5391 | } else if (strstr(cmd, "on")) { |
diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 6e02c953d888..601ea9512242 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c | |||
@@ -780,7 +780,7 @@ static bool guid_already_parsed(const char *guid_string) | |||
780 | /* | 780 | /* |
781 | * Parse the _WDG method for the GUID data blocks | 781 | * Parse the _WDG method for the GUID data blocks |
782 | */ | 782 | */ |
783 | static acpi_status parse_wdg(acpi_handle handle) | 783 | static int parse_wdg(acpi_handle handle) |
784 | { | 784 | { |
785 | struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; | 785 | struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; |
786 | union acpi_object *obj; | 786 | union acpi_object *obj; |
@@ -812,7 +812,7 @@ static acpi_status parse_wdg(acpi_handle handle) | |||
812 | 812 | ||
813 | wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); | 813 | wblock = kzalloc(sizeof(struct wmi_block), GFP_KERNEL); |
814 | if (!wblock) | 814 | if (!wblock) |
815 | return AE_NO_MEMORY; | 815 | return -ENOMEM; |
816 | 816 | ||
817 | wblock->handle = handle; | 817 | wblock->handle = handle; |
818 | wblock->gblock = gblock[i]; | 818 | wblock->gblock = gblock[i]; |