aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorAlan Jenkins <alan-jenkins@tuffmail.co.uk>2009-12-03 02:45:08 -0500
committerLen Brown <len.brown@intel.com>2009-12-09 15:54:32 -0500
commita7624b63fdf50d7f460170891a49397280f08758 (patch)
tree19c4b0171a27d706f9201a4749fe7ba2d90068bd /drivers/platform
parent52bbe3c7b413d656833686f9f08e5dcab3786eeb (diff)
eeepc-laptop: revise names
eeepc-laptop now does a lot more than just hotkeys. Replace the "hotk" names used throughout the driver with some slightly more appropriate names. The actual strings used in kernel messages and sysfs are left unchanged. e.g. EEEPC_HOTK_FILE -> EEEPC_LAPTOP_FILE EEEPC_HOTK_HID -> EEEPC_ACPI_HID eeepc_hotk_notify -> eeepc_acpi_notify struct eeepc_hotk -> struct eeepc_laptop ehotk -> eeepc I'm about to refactor the entire driver to remove the global "ehotk" variable, and I don't wish to add "struct eeepc_hotk *ehotk" to functions which have nothing to do with hotkeys. Also - fix the name of "eepc_get_entry_by_keycode()" - remove the unused definition of NOTIFY_WLAN_ON. Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/eeepc-laptop.c253
1 files changed, 125 insertions, 128 deletions
diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index f457587e64d3..b9b5aebbd5b0 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * eepc-laptop.c - Asus Eee PC extras 2 * eeepc-laptop.c - Asus Eee PC extras
3 * 3 *
4 * Based on asus_acpi.c as patched for the Eee PC by Asus: 4 * Based on asus_acpi.c as patched for the Eee PC by Asus:
5 * ftp://ftp.asus.com/pub/ASUS/EeePC/701/ASUS_ACPI_071126.rar 5 * ftp://ftp.asus.com/pub/ASUS/EeePC/701/ASUS_ACPI_071126.rar
@@ -37,21 +37,20 @@
37#include <linux/leds.h> 37#include <linux/leds.h>
38 38
39#define EEEPC_LAPTOP_VERSION "0.1" 39#define EEEPC_LAPTOP_VERSION "0.1"
40#define EEEPC_LAPTOP_NAME "Eee PC Hotkey Driver"
41#define EEEPC_LAPTOP_FILE "eeepc"
40 42
41#define EEEPC_HOTK_NAME "Eee PC Hotkey Driver" 43#define EEEPC_ACPI_CLASS "hotkey"
42#define EEEPC_HOTK_FILE "eeepc" 44#define EEEPC_ACPI_DEVICE_NAME "Hotkey"
43#define EEEPC_HOTK_CLASS "hotkey" 45#define EEEPC_ACPI_HID "ASUS010"
44#define EEEPC_HOTK_DEVICE_NAME "Hotkey"
45#define EEEPC_HOTK_HID "ASUS010"
46 46
47MODULE_AUTHOR("Corentin Chary, Eric Cooper"); 47MODULE_AUTHOR("Corentin Chary, Eric Cooper");
48MODULE_DESCRIPTION(EEEPC_HOTK_NAME); 48MODULE_DESCRIPTION(EEEPC_LAPTOP_NAME);
49MODULE_LICENSE("GPL"); 49MODULE_LICENSE("GPL");
50 50
51/* 51/*
52 * Definitions for Asus EeePC 52 * Definitions for Asus EeePC
53 */ 53 */
54#define NOTIFY_WLAN_ON 0x10
55#define NOTIFY_BRN_MIN 0x20 54#define NOTIFY_BRN_MIN 0x20
56#define NOTIFY_BRN_MAX 0x2f 55#define NOTIFY_BRN_MAX 0x2f
57 56
@@ -152,9 +151,8 @@ static struct key_entry eeepc_keymap[] = {
152 151
153/* 152/*
154 * This is the main structure, we can use it to store useful information 153 * This is the main structure, we can use it to store useful information
155 * about the hotk device
156 */ 154 */
157struct eeepc_hotk { 155struct eeepc_laptop {
158 struct acpi_device *device; /* the device we are in */ 156 struct acpi_device *device; /* the device we are in */
159 acpi_handle handle; /* the handle of the hotk device */ 157 acpi_handle handle; /* the handle of the hotk device */
160 u32 cm_supported; /* the control methods supported 158 u32 cm_supported; /* the control methods supported
@@ -171,7 +169,7 @@ struct eeepc_hotk {
171}; 169};
172 170
173/* The actual device the driver binds to */ 171/* The actual device the driver binds to */
174static struct eeepc_hotk *ehotk; 172static struct eeepc_laptop *eeepc;
175 173
176/* The platform device */ 174/* The platform device */
177static struct platform_device *platform_device; 175static struct platform_device *platform_device;
@@ -222,10 +220,10 @@ static int set_acpi(int cm, int value)
222 220
223 if (method == NULL) 221 if (method == NULL)
224 return -ENODEV; 222 return -ENODEV;
225 if ((ehotk->cm_supported & (0x1 << cm)) == 0) 223 if ((eeepc->cm_supported & (0x1 << cm)) == 0)
226 return -ENODEV; 224 return -ENODEV;
227 225
228 if (write_acpi_int(ehotk->handle, method, value)) 226 if (write_acpi_int(eeepc->handle, method, value))
229 pr_warning("Error writing %s\n", method); 227 pr_warning("Error writing %s\n", method);
230 return 0; 228 return 0;
231} 229}
@@ -237,10 +235,10 @@ static int get_acpi(int cm)
237 235
238 if (method == NULL) 236 if (method == NULL)
239 return -ENODEV; 237 return -ENODEV;
240 if ((ehotk->cm_supported & (0x1 << cm)) == 0) 238 if ((eeepc->cm_supported & (0x1 << cm)) == 0)
241 return -ENODEV; 239 return -ENODEV;
242 240
243 if (read_acpi_int(ehotk->handle, method, &value)) 241 if (read_acpi_int(eeepc->handle, method, &value))
244 pr_warning("Error reading %s\n", method); 242 pr_warning("Error reading %s\n", method);
245 return value; 243 return value;
246} 244}
@@ -395,7 +393,7 @@ static int eeepc_platform_init(void)
395{ 393{
396 int result; 394 int result;
397 395
398 platform_device = platform_device_alloc(EEEPC_HOTK_FILE, -1); 396 platform_device = platform_device_alloc(EEEPC_LAPTOP_FILE, -1);
399 if (!platform_device) 397 if (!platform_device)
400 return -ENOMEM; 398 return -ENOMEM;
401 399
@@ -501,12 +499,12 @@ static void eeepc_rfkill_hotplug(void)
501 struct pci_bus *bus; 499 struct pci_bus *bus;
502 bool blocked = eeepc_wlan_rfkill_blocked(); 500 bool blocked = eeepc_wlan_rfkill_blocked();
503 501
504 if (ehotk->wlan_rfkill) 502 if (eeepc->wlan_rfkill)
505 rfkill_set_sw_state(ehotk->wlan_rfkill, blocked); 503 rfkill_set_sw_state(eeepc->wlan_rfkill, blocked);
506 504
507 mutex_lock(&ehotk->hotplug_lock); 505 mutex_lock(&eeepc->hotplug_lock);
508 506
509 if (ehotk->hotplug_slot) { 507 if (eeepc->hotplug_slot) {
510 bus = pci_find_bus(0, 1); 508 bus = pci_find_bus(0, 1);
511 if (!bus) { 509 if (!bus) {
512 pr_warning("Unable to find PCI bus 1?\n"); 510 pr_warning("Unable to find PCI bus 1?\n");
@@ -536,7 +534,7 @@ static void eeepc_rfkill_hotplug(void)
536 } 534 }
537 535
538out_unlock: 536out_unlock:
539 mutex_unlock(&ehotk->hotplug_lock); 537 mutex_unlock(&eeepc->hotplug_lock);
540} 538}
541 539
542static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data) 540static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
@@ -619,22 +617,22 @@ static int eeepc_setup_pci_hotplug(void)
619 return -ENODEV; 617 return -ENODEV;
620 } 618 }
621 619
622 ehotk->hotplug_slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL); 620 eeepc->hotplug_slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL);
623 if (!ehotk->hotplug_slot) 621 if (!eeepc->hotplug_slot)
624 goto error_slot; 622 goto error_slot;
625 623
626 ehotk->hotplug_slot->info = kzalloc(sizeof(struct hotplug_slot_info), 624 eeepc->hotplug_slot->info = kzalloc(sizeof(struct hotplug_slot_info),
627 GFP_KERNEL); 625 GFP_KERNEL);
628 if (!ehotk->hotplug_slot->info) 626 if (!eeepc->hotplug_slot->info)
629 goto error_info; 627 goto error_info;
630 628
631 ehotk->hotplug_slot->private = ehotk; 629 eeepc->hotplug_slot->private = eeepc;
632 ehotk->hotplug_slot->release = &eeepc_cleanup_pci_hotplug; 630 eeepc->hotplug_slot->release = &eeepc_cleanup_pci_hotplug;
633 ehotk->hotplug_slot->ops = &eeepc_hotplug_slot_ops; 631 eeepc->hotplug_slot->ops = &eeepc_hotplug_slot_ops;
634 eeepc_get_adapter_status(ehotk->hotplug_slot, 632 eeepc_get_adapter_status(eeepc->hotplug_slot,
635 &ehotk->hotplug_slot->info->adapter_status); 633 &eeepc->hotplug_slot->info->adapter_status);
636 634
637 ret = pci_hp_register(ehotk->hotplug_slot, bus, 0, "eeepc-wifi"); 635 ret = pci_hp_register(eeepc->hotplug_slot, bus, 0, "eeepc-wifi");
638 if (ret) { 636 if (ret) {
639 pr_err("Unable to register hotplug slot - %d\n", ret); 637 pr_err("Unable to register hotplug slot - %d\n", ret);
640 goto error_register; 638 goto error_register;
@@ -643,10 +641,10 @@ static int eeepc_setup_pci_hotplug(void)
643 return 0; 641 return 0;
644 642
645error_register: 643error_register:
646 kfree(ehotk->hotplug_slot->info); 644 kfree(eeepc->hotplug_slot->info);
647error_info: 645error_info:
648 kfree(ehotk->hotplug_slot); 646 kfree(eeepc->hotplug_slot);
649 ehotk->hotplug_slot = NULL; 647 eeepc->hotplug_slot = NULL;
650error_slot: 648error_slot:
651 return ret; 649 return ret;
652} 650}
@@ -695,33 +693,33 @@ static void eeepc_rfkill_exit(void)
695 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P5"); 693 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P5");
696 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6"); 694 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6");
697 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7"); 695 eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7");
698 if (ehotk->wlan_rfkill) { 696 if (eeepc->wlan_rfkill) {
699 rfkill_unregister(ehotk->wlan_rfkill); 697 rfkill_unregister(eeepc->wlan_rfkill);
700 rfkill_destroy(ehotk->wlan_rfkill); 698 rfkill_destroy(eeepc->wlan_rfkill);
701 ehotk->wlan_rfkill = NULL; 699 eeepc->wlan_rfkill = NULL;
702 } 700 }
703 /* 701 /*
704 * Refresh pci hotplug in case the rfkill state was changed after 702 * Refresh pci hotplug in case the rfkill state was changed after
705 * eeepc_unregister_rfkill_notifier() 703 * eeepc_unregister_rfkill_notifier()
706 */ 704 */
707 eeepc_rfkill_hotplug(); 705 eeepc_rfkill_hotplug();
708 if (ehotk->hotplug_slot) 706 if (eeepc->hotplug_slot)
709 pci_hp_deregister(ehotk->hotplug_slot); 707 pci_hp_deregister(eeepc->hotplug_slot);
710 708
711 if (ehotk->bluetooth_rfkill) { 709 if (eeepc->bluetooth_rfkill) {
712 rfkill_unregister(ehotk->bluetooth_rfkill); 710 rfkill_unregister(eeepc->bluetooth_rfkill);
713 rfkill_destroy(ehotk->bluetooth_rfkill); 711 rfkill_destroy(eeepc->bluetooth_rfkill);
714 ehotk->bluetooth_rfkill = NULL; 712 eeepc->bluetooth_rfkill = NULL;
715 } 713 }
716 if (ehotk->wwan3g_rfkill) { 714 if (eeepc->wwan3g_rfkill) {
717 rfkill_unregister(ehotk->wwan3g_rfkill); 715 rfkill_unregister(eeepc->wwan3g_rfkill);
718 rfkill_destroy(ehotk->wwan3g_rfkill); 716 rfkill_destroy(eeepc->wwan3g_rfkill);
719 ehotk->wwan3g_rfkill = NULL; 717 eeepc->wwan3g_rfkill = NULL;
720 } 718 }
721 if (ehotk->wimax_rfkill) { 719 if (eeepc->wimax_rfkill) {
722 rfkill_unregister(ehotk->wimax_rfkill); 720 rfkill_unregister(eeepc->wimax_rfkill);
723 rfkill_destroy(ehotk->wimax_rfkill); 721 rfkill_destroy(eeepc->wimax_rfkill);
724 ehotk->wimax_rfkill = NULL; 722 eeepc->wimax_rfkill = NULL;
725 } 723 }
726} 724}
727 725
@@ -729,30 +727,30 @@ static int eeepc_rfkill_init(struct device *dev)
729{ 727{
730 int result = 0; 728 int result = 0;
731 729
732 mutex_init(&ehotk->hotplug_lock); 730 mutex_init(&eeepc->hotplug_lock);
733 731
734 result = eeepc_new_rfkill(&ehotk->wlan_rfkill, 732 result = eeepc_new_rfkill(&eeepc->wlan_rfkill,
735 "eeepc-wlan", dev, 733 "eeepc-wlan", dev,
736 RFKILL_TYPE_WLAN, CM_ASL_WLAN); 734 RFKILL_TYPE_WLAN, CM_ASL_WLAN);
737 735
738 if (result && result != -ENODEV) 736 if (result && result != -ENODEV)
739 goto exit; 737 goto exit;
740 738
741 result = eeepc_new_rfkill(&ehotk->bluetooth_rfkill, 739 result = eeepc_new_rfkill(&eeepc->bluetooth_rfkill,
742 "eeepc-bluetooth", dev, 740 "eeepc-bluetooth", dev,
743 RFKILL_TYPE_BLUETOOTH, CM_ASL_BLUETOOTH); 741 RFKILL_TYPE_BLUETOOTH, CM_ASL_BLUETOOTH);
744 742
745 if (result && result != -ENODEV) 743 if (result && result != -ENODEV)
746 goto exit; 744 goto exit;
747 745
748 result = eeepc_new_rfkill(&ehotk->wwan3g_rfkill, 746 result = eeepc_new_rfkill(&eeepc->wwan3g_rfkill,
749 "eeepc-wwan3g", dev, 747 "eeepc-wwan3g", dev,
750 RFKILL_TYPE_WWAN, CM_ASL_3G); 748 RFKILL_TYPE_WWAN, CM_ASL_3G);
751 749
752 if (result && result != -ENODEV) 750 if (result && result != -ENODEV)
753 goto exit; 751 goto exit;
754 752
755 result = eeepc_new_rfkill(&ehotk->wimax_rfkill, 753 result = eeepc_new_rfkill(&eeepc->wimax_rfkill,
756 "eeepc-wimax", dev, 754 "eeepc-wimax", dev,
757 RFKILL_TYPE_WIMAX, CM_ASL_WIMAX); 755 RFKILL_TYPE_WIMAX, CM_ASL_WIMAX);
758 756
@@ -785,9 +783,9 @@ exit:
785/* 783/*
786 * Platform driver - hibernate/resume callbacks 784 * Platform driver - hibernate/resume callbacks
787 */ 785 */
788static int eeepc_hotk_thaw(struct device *device) 786static int eeepc_thaw(struct device *device)
789{ 787{
790 if (ehotk->wlan_rfkill) { 788 if (eeepc->wlan_rfkill) {
791 bool wlan; 789 bool wlan;
792 790
793 /* 791 /*
@@ -802,33 +800,33 @@ static int eeepc_hotk_thaw(struct device *device)
802 return 0; 800 return 0;
803} 801}
804 802
805static int eeepc_hotk_restore(struct device *device) 803static int eeepc_restore(struct device *device)
806{ 804{
807 /* Refresh both wlan rfkill state and pci hotplug */ 805 /* Refresh both wlan rfkill state and pci hotplug */
808 if (ehotk->wlan_rfkill) 806 if (eeepc->wlan_rfkill)
809 eeepc_rfkill_hotplug(); 807 eeepc_rfkill_hotplug();
810 808
811 if (ehotk->bluetooth_rfkill) 809 if (eeepc->bluetooth_rfkill)
812 rfkill_set_sw_state(ehotk->bluetooth_rfkill, 810 rfkill_set_sw_state(eeepc->bluetooth_rfkill,
813 get_acpi(CM_ASL_BLUETOOTH) != 1); 811 get_acpi(CM_ASL_BLUETOOTH) != 1);
814 if (ehotk->wwan3g_rfkill) 812 if (eeepc->wwan3g_rfkill)
815 rfkill_set_sw_state(ehotk->wwan3g_rfkill, 813 rfkill_set_sw_state(eeepc->wwan3g_rfkill,
816 get_acpi(CM_ASL_3G) != 1); 814 get_acpi(CM_ASL_3G) != 1);
817 if (ehotk->wimax_rfkill) 815 if (eeepc->wimax_rfkill)
818 rfkill_set_sw_state(ehotk->wimax_rfkill, 816 rfkill_set_sw_state(eeepc->wimax_rfkill,
819 get_acpi(CM_ASL_WIMAX) != 1); 817 get_acpi(CM_ASL_WIMAX) != 1);
820 818
821 return 0; 819 return 0;
822} 820}
823 821
824static struct dev_pm_ops eeepc_pm_ops = { 822static struct dev_pm_ops eeepc_pm_ops = {
825 .thaw = eeepc_hotk_thaw, 823 .thaw = eeepc_thaw,
826 .restore = eeepc_hotk_restore, 824 .restore = eeepc_restore,
827}; 825};
828 826
829static struct platform_driver platform_driver = { 827static struct platform_driver platform_driver = {
830 .driver = { 828 .driver = {
831 .name = EEEPC_HOTK_FILE, 829 .name = EEEPC_LAPTOP_FILE,
832 .owner = THIS_MODULE, 830 .owner = THIS_MODULE,
833 .pm = &eeepc_pm_ops, 831 .pm = &eeepc_pm_ops,
834 } 832 }
@@ -1018,7 +1016,7 @@ static int eeepc_backlight_init(struct device *dev)
1018{ 1016{
1019 struct backlight_device *bd; 1017 struct backlight_device *bd;
1020 1018
1021 bd = backlight_device_register(EEEPC_HOTK_FILE, dev, 1019 bd = backlight_device_register(EEEPC_LAPTOP_FILE, dev,
1022 NULL, &eeepcbl_ops); 1020 NULL, &eeepcbl_ops);
1023 if (IS_ERR(bd)) { 1021 if (IS_ERR(bd)) {
1024 pr_err("Could not register eeepc backlight device\n"); 1022 pr_err("Could not register eeepc backlight device\n");
@@ -1063,12 +1061,12 @@ static void eeepc_input_notify(int event)
1063 if (key) { 1061 if (key) {
1064 switch (key->type) { 1062 switch (key->type) {
1065 case KE_KEY: 1063 case KE_KEY:
1066 input_report_key(ehotk->inputdev, key->keycode, 1064 input_report_key(eeepc->inputdev, key->keycode,
1067 1); 1065 1);
1068 input_sync(ehotk->inputdev); 1066 input_sync(eeepc->inputdev);
1069 input_report_key(ehotk->inputdev, key->keycode, 1067 input_report_key(eeepc->inputdev, key->keycode,
1070 0); 1068 0);
1071 input_sync(ehotk->inputdev); 1069 input_sync(eeepc->inputdev);
1072 break; 1070 break;
1073 } 1071 }
1074 } 1072 }
@@ -1123,30 +1121,30 @@ static int eeepc_input_init(struct device *dev)
1123 const struct key_entry *key; 1121 const struct key_entry *key;
1124 int result; 1122 int result;
1125 1123
1126 ehotk->inputdev = input_allocate_device(); 1124 eeepc->inputdev = input_allocate_device();
1127 if (!ehotk->inputdev) { 1125 if (!eeepc->inputdev) {
1128 pr_info("Unable to allocate input device\n"); 1126 pr_info("Unable to allocate input device\n");
1129 return -ENOMEM; 1127 return -ENOMEM;
1130 } 1128 }
1131 ehotk->inputdev->name = "Asus EeePC extra buttons"; 1129 eeepc->inputdev->name = "Asus EeePC extra buttons";
1132 ehotk->inputdev->dev.parent = dev; 1130 eeepc->inputdev->dev.parent = dev;
1133 ehotk->inputdev->phys = EEEPC_HOTK_FILE "/input0"; 1131 eeepc->inputdev->phys = EEEPC_LAPTOP_FILE "/input0";
1134 ehotk->inputdev->id.bustype = BUS_HOST; 1132 eeepc->inputdev->id.bustype = BUS_HOST;
1135 ehotk->inputdev->getkeycode = eeepc_getkeycode; 1133 eeepc->inputdev->getkeycode = eeepc_getkeycode;
1136 ehotk->inputdev->setkeycode = eeepc_setkeycode; 1134 eeepc->inputdev->setkeycode = eeepc_setkeycode;
1137 1135
1138 for (key = eeepc_keymap; key->type != KE_END; key++) { 1136 for (key = eeepc_keymap; key->type != KE_END; key++) {
1139 switch (key->type) { 1137 switch (key->type) {
1140 case KE_KEY: 1138 case KE_KEY:
1141 set_bit(EV_KEY, ehotk->inputdev->evbit); 1139 set_bit(EV_KEY, eeepc->inputdev->evbit);
1142 set_bit(key->keycode, ehotk->inputdev->keybit); 1140 set_bit(key->keycode, eeepc->inputdev->keybit);
1143 break; 1141 break;
1144 } 1142 }
1145 } 1143 }
1146 result = input_register_device(ehotk->inputdev); 1144 result = input_register_device(eeepc->inputdev);
1147 if (result) { 1145 if (result) {
1148 pr_info("Unable to register input device\n"); 1146 pr_info("Unable to register input device\n");
1149 input_free_device(ehotk->inputdev); 1147 input_free_device(eeepc->inputdev);
1150 return result; 1148 return result;
1151 } 1149 }
1152 return 0; 1150 return 0;
@@ -1154,23 +1152,23 @@ static int eeepc_input_init(struct device *dev)
1154 1152
1155static void eeepc_input_exit(void) 1153static void eeepc_input_exit(void)
1156{ 1154{
1157 if (ehotk->inputdev) 1155 if (eeepc->inputdev)
1158 input_unregister_device(ehotk->inputdev); 1156 input_unregister_device(eeepc->inputdev);
1159} 1157}
1160 1158
1161/* 1159/*
1162 * ACPI driver 1160 * ACPI driver
1163 */ 1161 */
1164static void eeepc_hotk_notify(struct acpi_device *device, u32 event) 1162static void eeepc_acpi_notify(struct acpi_device *device, u32 event)
1165{ 1163{
1166 u16 count; 1164 u16 count;
1167 1165
1168 if (event > ACPI_MAX_SYS_NOTIFY) 1166 if (event > ACPI_MAX_SYS_NOTIFY)
1169 return; 1167 return;
1170 count = ehotk->event_count[event % 128]++; 1168 count = eeepc->event_count[event % 128]++;
1171 acpi_bus_generate_proc_event(ehotk->device, event, count); 1169 acpi_bus_generate_proc_event(eeepc->device, event, count);
1172 acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class, 1170 acpi_bus_generate_netlink_event(eeepc->device->pnp.device_class,
1173 dev_name(&ehotk->device->dev), event, 1171 dev_name(&eeepc->device->dev), event,
1174 count); 1172 count);
1175 1173
1176 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) { 1174 if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX) {
@@ -1202,11 +1200,11 @@ static void cmsg_quirk(int cm, const char *name)
1202 1200
1203 /* Some BIOSes do not report cm although it is avaliable. 1201 /* Some BIOSes do not report cm although it is avaliable.
1204 Check if cm_getv[cm] works and, if yes, assume cm should be set. */ 1202 Check if cm_getv[cm] works and, if yes, assume cm should be set. */
1205 if (!(ehotk->cm_supported & (1 << cm)) 1203 if (!(eeepc->cm_supported & (1 << cm))
1206 && !read_acpi_int(ehotk->handle, cm_getv[cm], &dummy)) { 1204 && !read_acpi_int(eeepc->handle, cm_getv[cm], &dummy)) {
1207 pr_info("%s (%x) not reported by BIOS," 1205 pr_info("%s (%x) not reported by BIOS,"
1208 " enabling anyway\n", name, 1 << cm); 1206 " enabling anyway\n", name, 1 << cm);
1209 ehotk->cm_supported |= 1 << cm; 1207 eeepc->cm_supported |= 1 << cm;
1210 } 1208 }
1211} 1209}
1212 1210
@@ -1218,15 +1216,15 @@ static void cmsg_quirks(void)
1218 cmsg_quirk(CM_ASL_TPD, "TPD"); 1216 cmsg_quirk(CM_ASL_TPD, "TPD");
1219} 1217}
1220 1218
1221static int eeepc_hotk_init(void) 1219static int eeepc_acpi_init(void)
1222{ 1220{
1223 unsigned int init_flags; 1221 unsigned int init_flags;
1224 int result; 1222 int result;
1225 1223
1226 result = acpi_bus_get_status(ehotk->device); 1224 result = acpi_bus_get_status(eeepc->device);
1227 if (result) 1225 if (result)
1228 return result; 1226 return result;
1229 if (!ehotk->device->status.present) { 1227 if (!eeepc->device->status.present) {
1230 pr_err("Hotkey device not present, aborting\n"); 1228 pr_err("Hotkey device not present, aborting\n");
1231 return -ENODEV; 1229 return -ENODEV;
1232 } 1230 }
@@ -1234,18 +1232,18 @@ static int eeepc_hotk_init(void)
1234 init_flags = DISABLE_ASL_WLAN | DISABLE_ASL_DISPLAYSWITCH; 1232 init_flags = DISABLE_ASL_WLAN | DISABLE_ASL_DISPLAYSWITCH;
1235 pr_notice("Hotkey init flags 0x%x\n", init_flags); 1233 pr_notice("Hotkey init flags 0x%x\n", init_flags);
1236 1234
1237 if (write_acpi_int(ehotk->handle, "INIT", init_flags)) { 1235 if (write_acpi_int(eeepc->handle, "INIT", init_flags)) {
1238 pr_err("Hotkey initialization failed\n"); 1236 pr_err("Hotkey initialization failed\n");
1239 return -ENODEV; 1237 return -ENODEV;
1240 } 1238 }
1241 1239
1242 /* get control methods supported */ 1240 /* get control methods supported */
1243 if (read_acpi_int(ehotk->handle, "CMSG", &ehotk->cm_supported)) { 1241 if (read_acpi_int(eeepc->handle, "CMSG", &eeepc->cm_supported)) {
1244 pr_err("Get control methods supported failed\n"); 1242 pr_err("Get control methods supported failed\n");
1245 return -ENODEV; 1243 return -ENODEV;
1246 } 1244 }
1247 cmsg_quirks(); 1245 cmsg_quirks();
1248 pr_info("Get control methods supported: 0x%x\n", ehotk->cm_supported); 1246 pr_info("Get control methods supported: 0x%x\n", eeepc->cm_supported);
1249 1247
1250 return 0; 1248 return 0;
1251} 1249}
@@ -1260,22 +1258,22 @@ static void __devinit eeepc_enable_camera(void)
1260 set_acpi(CM_ASL_CAMERA, 1); 1258 set_acpi(CM_ASL_CAMERA, 1);
1261} 1259}
1262 1260
1263static int __devinit eeepc_hotk_add(struct acpi_device *device) 1261static int __devinit eeepc_acpi_add(struct acpi_device *device)
1264{ 1262{
1265 struct device *dev; 1263 struct device *dev;
1266 int result; 1264 int result;
1267 1265
1268 pr_notice(EEEPC_HOTK_NAME "\n"); 1266 pr_notice(EEEPC_LAPTOP_NAME "\n");
1269 ehotk = kzalloc(sizeof(struct eeepc_hotk), GFP_KERNEL); 1267 eeepc = kzalloc(sizeof(struct eeepc_laptop), GFP_KERNEL);
1270 if (!ehotk) 1268 if (!eeepc)
1271 return -ENOMEM; 1269 return -ENOMEM;
1272 ehotk->handle = device->handle; 1270 eeepc->handle = device->handle;
1273 strcpy(acpi_device_name(device), EEEPC_HOTK_DEVICE_NAME); 1271 strcpy(acpi_device_name(device), EEEPC_ACPI_DEVICE_NAME);
1274 strcpy(acpi_device_class(device), EEEPC_HOTK_CLASS); 1272 strcpy(acpi_device_class(device), EEEPC_ACPI_CLASS);
1275 device->driver_data = ehotk; 1273 device->driver_data = eeepc;
1276 ehotk->device = device; 1274 eeepc->device = device;
1277 1275
1278 result = eeepc_hotk_init(); 1276 result = eeepc_acpi_init();
1279 if (result) 1277 if (result)
1280 goto fail_platform; 1278 goto fail_platform;
1281 eeepc_enable_camera(); 1279 eeepc_enable_camera();
@@ -1283,7 +1281,6 @@ static int __devinit eeepc_hotk_add(struct acpi_device *device)
1283 result = eeepc_platform_init(); 1281 result = eeepc_platform_init();
1284 if (result) 1282 if (result)
1285 goto fail_platform; 1283 goto fail_platform;
1286
1287 dev = &platform_device->dev; 1284 dev = &platform_device->dev;
1288 1285
1289 if (!acpi_video_backlight_support()) { 1286 if (!acpi_video_backlight_support()) {
@@ -1322,12 +1319,12 @@ fail_input:
1322fail_backlight: 1319fail_backlight:
1323 eeepc_platform_exit(); 1320 eeepc_platform_exit();
1324fail_platform: 1321fail_platform:
1325 kfree(ehotk); 1322 kfree(eeepc);
1326 1323
1327 return result; 1324 return result;
1328} 1325}
1329 1326
1330static int eeepc_hotk_remove(struct acpi_device *device, int type) 1327static int eeepc_acpi_remove(struct acpi_device *device, int type)
1331{ 1328{
1332 eeepc_backlight_exit(); 1329 eeepc_backlight_exit();
1333 eeepc_rfkill_exit(); 1330 eeepc_rfkill_exit();
@@ -1336,27 +1333,27 @@ static int eeepc_hotk_remove(struct acpi_device *device, int type)
1336 eeepc_led_exit(); 1333 eeepc_led_exit();
1337 eeepc_platform_exit(); 1334 eeepc_platform_exit();
1338 1335
1339 kfree(ehotk); 1336 kfree(eeepc);
1340 return 0; 1337 return 0;
1341} 1338}
1342 1339
1343 1340
1344static const struct acpi_device_id eeepc_device_ids[] = { 1341static const struct acpi_device_id eeepc_device_ids[] = {
1345 {EEEPC_HOTK_HID, 0}, 1342 {EEEPC_ACPI_HID, 0},
1346 {"", 0}, 1343 {"", 0},
1347}; 1344};
1348MODULE_DEVICE_TABLE(acpi, eeepc_device_ids); 1345MODULE_DEVICE_TABLE(acpi, eeepc_device_ids);
1349 1346
1350static struct acpi_driver eeepc_hotk_driver = { 1347static struct acpi_driver eeepc_acpi_driver = {
1351 .name = EEEPC_HOTK_NAME, 1348 .name = EEEPC_LAPTOP_NAME,
1352 .class = EEEPC_HOTK_CLASS, 1349 .class = EEEPC_ACPI_CLASS,
1353 .owner = THIS_MODULE, 1350 .owner = THIS_MODULE,
1354 .ids = eeepc_device_ids, 1351 .ids = eeepc_device_ids,
1355 .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, 1352 .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
1356 .ops = { 1353 .ops = {
1357 .add = eeepc_hotk_add, 1354 .add = eeepc_acpi_add,
1358 .remove = eeepc_hotk_remove, 1355 .remove = eeepc_acpi_remove,
1359 .notify = eeepc_hotk_notify, 1356 .notify = eeepc_acpi_notify,
1360 }, 1357 },
1361}; 1358};
1362 1359
@@ -1369,17 +1366,17 @@ static int __init eeepc_laptop_init(void)
1369 if (result < 0) 1366 if (result < 0)
1370 return result; 1367 return result;
1371 1368
1372 result = acpi_bus_register_driver(&eeepc_hotk_driver); 1369 result = acpi_bus_register_driver(&eeepc_acpi_driver);
1373 if (result < 0) 1370 if (result < 0)
1374 goto fail_acpi_driver; 1371 goto fail_acpi_driver;
1375 if (!ehotk) { 1372 if (!eeepc) {
1376 result = -ENODEV; 1373 result = -ENODEV;
1377 goto fail_no_device; 1374 goto fail_no_device;
1378 } 1375 }
1379 return 0; 1376 return 0;
1380 1377
1381fail_no_device: 1378fail_no_device:
1382 acpi_bus_unregister_driver(&eeepc_hotk_driver); 1379 acpi_bus_unregister_driver(&eeepc_acpi_driver);
1383fail_acpi_driver: 1380fail_acpi_driver:
1384 platform_driver_unregister(&platform_driver); 1381 platform_driver_unregister(&platform_driver);
1385 return result; 1382 return result;
@@ -1387,7 +1384,7 @@ fail_acpi_driver:
1387 1384
1388static void __exit eeepc_laptop_exit(void) 1385static void __exit eeepc_laptop_exit(void)
1389{ 1386{
1390 acpi_bus_unregister_driver(&eeepc_hotk_driver); 1387 acpi_bus_unregister_driver(&eeepc_acpi_driver);
1391 platform_driver_unregister(&platform_driver); 1388 platform_driver_unregister(&platform_driver);
1392} 1389}
1393 1390