aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/asus_acpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/asus_acpi.c')
-rw-r--r--drivers/acpi/asus_acpi.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index f4c87750dbf2..839f423d738d 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -817,7 +817,7 @@ typedef int (proc_writefunc) (struct file * file, const char __user * buffer,
817 unsigned long count, void *data); 817 unsigned long count, void *data);
818 818
819static int 819static int
820__init asus_proc_add(char *name, proc_writefunc * writefunc, 820asus_proc_add(char *name, proc_writefunc * writefunc,
821 proc_readfunc * readfunc, mode_t mode, 821 proc_readfunc * readfunc, mode_t mode,
822 struct acpi_device *device) 822 struct acpi_device *device)
823{ 823{
@@ -836,7 +836,7 @@ __init asus_proc_add(char *name, proc_writefunc * writefunc,
836 return 0; 836 return 0;
837} 837}
838 838
839static int __init asus_hotk_add_fs(struct acpi_device *device) 839static int asus_hotk_add_fs(struct acpi_device *device)
840{ 840{
841 struct proc_dir_entry *proc; 841 struct proc_dir_entry *proc;
842 mode_t mode; 842 mode_t mode;
@@ -954,7 +954,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
954 * This function is used to initialize the hotk with right values. In this 954 * This function is used to initialize the hotk with right values. In this
955 * method, we can make all the detection we want, and modify the hotk struct 955 * method, we can make all the detection we want, and modify the hotk struct
956 */ 956 */
957static int __init asus_hotk_get_info(void) 957static int asus_hotk_get_info(void)
958{ 958{
959 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 959 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
960 struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; 960 struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL };
@@ -970,7 +970,7 @@ static int __init asus_hotk_get_info(void)
970 * HID), this bit will be moved. A global variable asus_info contains 970 * HID), this bit will be moved. A global variable asus_info contains
971 * the DSDT header. 971 * the DSDT header.
972 */ 972 */
973 status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt); 973 status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt);
974 if (ACPI_FAILURE(status)) 974 if (ACPI_FAILURE(status))
975 printk(KERN_WARNING " Couldn't get the DSDT table header\n"); 975 printk(KERN_WARNING " Couldn't get the DSDT table header\n");
976 else 976 else
@@ -1101,7 +1101,7 @@ static int __init asus_hotk_get_info(void)
1101 return AE_OK; 1101 return AE_OK;
1102} 1102}
1103 1103
1104static int __init asus_hotk_check(void) 1104static int asus_hotk_check(void)
1105{ 1105{
1106 int result = 0; 1106 int result = 0;
1107 1107
@@ -1119,7 +1119,9 @@ static int __init asus_hotk_check(void)
1119 return result; 1119 return result;
1120} 1120}
1121 1121
1122static int __init asus_hotk_add(struct acpi_device *device) 1122static int asus_hotk_found;
1123
1124static int asus_hotk_add(struct acpi_device *device)
1123{ 1125{
1124 acpi_status status = AE_OK; 1126 acpi_status status = AE_OK;
1125 int result; 1127 int result;
@@ -1180,6 +1182,8 @@ static int __init asus_hotk_add(struct acpi_device *device)
1180 } 1182 }
1181 } 1183 }
1182 1184
1185 asus_hotk_found = 1;
1186
1183 end: 1187 end:
1184 if (result) { 1188 if (result) {
1185 kfree(hotk); 1189 kfree(hotk);
@@ -1226,12 +1230,24 @@ static int __init asus_acpi_init(void)
1226 asus_proc_dir->owner = THIS_MODULE; 1230 asus_proc_dir->owner = THIS_MODULE;
1227 1231
1228 result = acpi_bus_register_driver(&asus_hotk_driver); 1232 result = acpi_bus_register_driver(&asus_hotk_driver);
1229 if (result < 1) { 1233 if (result < 0) {
1230 acpi_bus_unregister_driver(&asus_hotk_driver);
1231 remove_proc_entry(PROC_ASUS, acpi_root_dir); 1234 remove_proc_entry(PROC_ASUS, acpi_root_dir);
1232 return -ENODEV; 1235 return -ENODEV;
1233 } 1236 }
1234 1237
1238 /*
1239 * This is a bit of a kludge. We only want this module loaded
1240 * for ASUS systems, but there's currently no way to probe the
1241 * ACPI namespace for ASUS HIDs. So we just return failure if
1242 * we didn't find one, which will cause the module to be
1243 * unloaded.
1244 */
1245 if (!asus_hotk_found) {
1246 acpi_bus_unregister_driver(&asus_hotk_driver);
1247 remove_proc_entry(PROC_ASUS, acpi_root_dir);
1248 return result;
1249 }
1250
1235 return 0; 1251 return 0;
1236} 1252}
1237 1253