aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/fujitsu-laptop.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/platform/x86/fujitsu-laptop.c')
-rw-r--r--drivers/platform/x86/fujitsu-laptop.c60
1 files changed, 9 insertions, 51 deletions
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index 45940f31fe9e..218b9a16ac3f 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -174,8 +174,7 @@ struct fujitsu_hotkey_t {
174 174
175static struct fujitsu_hotkey_t *fujitsu_hotkey; 175static struct fujitsu_hotkey_t *fujitsu_hotkey;
176 176
177static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, 177static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event);
178 void *data);
179 178
180#ifdef CONFIG_LEDS_CLASS 179#ifdef CONFIG_LEDS_CLASS
181static enum led_brightness logolamp_get(struct led_classdev *cdev); 180static enum led_brightness logolamp_get(struct led_classdev *cdev);
@@ -203,7 +202,7 @@ struct led_classdev kblamps_led = {
203static u32 dbg_level = 0x03; 202static u32 dbg_level = 0x03;
204#endif 203#endif
205 204
206static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data); 205static void acpi_fujitsu_notify(struct acpi_device *device, u32 event);
207 206
208/* Fujitsu ACPI interface function */ 207/* Fujitsu ACPI interface function */
209 208
@@ -658,7 +657,6 @@ static struct dmi_system_id fujitsu_dmi_table[] = {
658 657
659static int acpi_fujitsu_add(struct acpi_device *device) 658static int acpi_fujitsu_add(struct acpi_device *device)
660{ 659{
661 acpi_status status;
662 acpi_handle handle; 660 acpi_handle handle;
663 int result = 0; 661 int result = 0;
664 int state = 0; 662 int state = 0;
@@ -673,20 +671,10 @@ static int acpi_fujitsu_add(struct acpi_device *device)
673 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); 671 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
674 device->driver_data = fujitsu; 672 device->driver_data = fujitsu;
675 673
676 status = acpi_install_notify_handler(device->handle,
677 ACPI_DEVICE_NOTIFY,
678 acpi_fujitsu_notify, fujitsu);
679
680 if (ACPI_FAILURE(status)) {
681 printk(KERN_ERR "Error installing notify handler\n");
682 error = -ENODEV;
683 goto err_stop;
684 }
685
686 fujitsu->input = input = input_allocate_device(); 674 fujitsu->input = input = input_allocate_device();
687 if (!input) { 675 if (!input) {
688 error = -ENOMEM; 676 error = -ENOMEM;
689 goto err_uninstall_notify; 677 goto err_stop;
690 } 678 }
691 679
692 snprintf(fujitsu->phys, sizeof(fujitsu->phys), 680 snprintf(fujitsu->phys, sizeof(fujitsu->phys),
@@ -743,9 +731,6 @@ static int acpi_fujitsu_add(struct acpi_device *device)
743end: 731end:
744err_free_input_dev: 732err_free_input_dev:
745 input_free_device(input); 733 input_free_device(input);
746err_uninstall_notify:
747 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
748 acpi_fujitsu_notify);
749err_stop: 734err_stop:
750 735
751 return result; 736 return result;
@@ -753,7 +738,6 @@ err_stop:
753 738
754static int acpi_fujitsu_remove(struct acpi_device *device, int type) 739static int acpi_fujitsu_remove(struct acpi_device *device, int type)
755{ 740{
756 acpi_status status;
757 struct fujitsu_t *fujitsu = NULL; 741 struct fujitsu_t *fujitsu = NULL;
758 742
759 if (!device || !acpi_driver_data(device)) 743 if (!device || !acpi_driver_data(device))
@@ -761,10 +745,6 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type)
761 745
762 fujitsu = acpi_driver_data(device); 746 fujitsu = acpi_driver_data(device);
763 747
764 status = acpi_remove_notify_handler(fujitsu->acpi_handle,
765 ACPI_DEVICE_NOTIFY,
766 acpi_fujitsu_notify);
767
768 if (!device || !acpi_driver_data(device)) 748 if (!device || !acpi_driver_data(device))
769 return -EINVAL; 749 return -EINVAL;
770 750
@@ -775,7 +755,7 @@ static int acpi_fujitsu_remove(struct acpi_device *device, int type)
775 755
776/* Brightness notify */ 756/* Brightness notify */
777 757
778static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data) 758static void acpi_fujitsu_notify(struct acpi_device *device, u32 event)
779{ 759{
780 struct input_dev *input; 760 struct input_dev *input;
781 int keycode; 761 int keycode;
@@ -829,15 +809,12 @@ static void acpi_fujitsu_notify(acpi_handle handle, u32 event, void *data)
829 input_report_key(input, keycode, 0); 809 input_report_key(input, keycode, 0);
830 input_sync(input); 810 input_sync(input);
831 } 811 }
832
833 return;
834} 812}
835 813
836/* ACPI device for hotkey handling */ 814/* ACPI device for hotkey handling */
837 815
838static int acpi_fujitsu_hotkey_add(struct acpi_device *device) 816static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
839{ 817{
840 acpi_status status;
841 acpi_handle handle; 818 acpi_handle handle;
842 int result = 0; 819 int result = 0;
843 int state = 0; 820 int state = 0;
@@ -854,17 +831,6 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
854 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS); 831 sprintf(acpi_device_class(device), "%s", ACPI_FUJITSU_CLASS);
855 device->driver_data = fujitsu_hotkey; 832 device->driver_data = fujitsu_hotkey;
856 833
857 status = acpi_install_notify_handler(device->handle,
858 ACPI_DEVICE_NOTIFY,
859 acpi_fujitsu_hotkey_notify,
860 fujitsu_hotkey);
861
862 if (ACPI_FAILURE(status)) {
863 printk(KERN_ERR "Error installing notify handler\n");
864 error = -ENODEV;
865 goto err_stop;
866 }
867
868 /* kfifo */ 834 /* kfifo */
869 spin_lock_init(&fujitsu_hotkey->fifo_lock); 835 spin_lock_init(&fujitsu_hotkey->fifo_lock);
870 fujitsu_hotkey->fifo = 836 fujitsu_hotkey->fifo =
@@ -879,7 +845,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
879 fujitsu_hotkey->input = input = input_allocate_device(); 845 fujitsu_hotkey->input = input = input_allocate_device();
880 if (!input) { 846 if (!input) {
881 error = -ENOMEM; 847 error = -ENOMEM;
882 goto err_uninstall_notify; 848 goto err_free_fifo;
883 } 849 }
884 850
885 snprintf(fujitsu_hotkey->phys, sizeof(fujitsu_hotkey->phys), 851 snprintf(fujitsu_hotkey->phys, sizeof(fujitsu_hotkey->phys),
@@ -975,9 +941,7 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
975end: 941end:
976err_free_input_dev: 942err_free_input_dev:
977 input_free_device(input); 943 input_free_device(input);
978err_uninstall_notify: 944err_free_fifo:
979 acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
980 acpi_fujitsu_hotkey_notify);
981 kfifo_free(fujitsu_hotkey->fifo); 945 kfifo_free(fujitsu_hotkey->fifo);
982err_stop: 946err_stop:
983 947
@@ -986,7 +950,6 @@ err_stop:
986 950
987static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type) 951static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
988{ 952{
989 acpi_status status;
990 struct fujitsu_hotkey_t *fujitsu_hotkey = NULL; 953 struct fujitsu_hotkey_t *fujitsu_hotkey = NULL;
991 954
992 if (!device || !acpi_driver_data(device)) 955 if (!device || !acpi_driver_data(device))
@@ -994,10 +957,6 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
994 957
995 fujitsu_hotkey = acpi_driver_data(device); 958 fujitsu_hotkey = acpi_driver_data(device);
996 959
997 status = acpi_remove_notify_handler(fujitsu_hotkey->acpi_handle,
998 ACPI_DEVICE_NOTIFY,
999 acpi_fujitsu_hotkey_notify);
1000
1001 fujitsu_hotkey->acpi_handle = NULL; 960 fujitsu_hotkey->acpi_handle = NULL;
1002 961
1003 kfifo_free(fujitsu_hotkey->fifo); 962 kfifo_free(fujitsu_hotkey->fifo);
@@ -1005,8 +964,7 @@ static int acpi_fujitsu_hotkey_remove(struct acpi_device *device, int type)
1005 return 0; 964 return 0;
1006} 965}
1007 966
1008static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event, 967static void acpi_fujitsu_hotkey_notify(struct acpi_device *device, u32 event)
1009 void *data)
1010{ 968{
1011 struct input_dev *input; 969 struct input_dev *input;
1012 int keycode, keycode_r; 970 int keycode, keycode_r;
@@ -1089,8 +1047,6 @@ static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event,
1089 input_sync(input); 1047 input_sync(input);
1090 break; 1048 break;
1091 } 1049 }
1092
1093 return;
1094} 1050}
1095 1051
1096/* Initialization */ 1052/* Initialization */
@@ -1107,6 +1063,7 @@ static struct acpi_driver acpi_fujitsu_driver = {
1107 .ops = { 1063 .ops = {
1108 .add = acpi_fujitsu_add, 1064 .add = acpi_fujitsu_add,
1109 .remove = acpi_fujitsu_remove, 1065 .remove = acpi_fujitsu_remove,
1066 .notify = acpi_fujitsu_notify,
1110 }, 1067 },
1111}; 1068};
1112 1069
@@ -1122,6 +1079,7 @@ static struct acpi_driver acpi_fujitsu_hotkey_driver = {
1122 .ops = { 1079 .ops = {
1123 .add = acpi_fujitsu_hotkey_add, 1080 .add = acpi_fujitsu_hotkey_add,
1124 .remove = acpi_fujitsu_hotkey_remove, 1081 .remove = acpi_fujitsu_hotkey_remove,
1082 .notify = acpi_fujitsu_hotkey_notify,
1125 }, 1083 },
1126}; 1084};
1127 1085