X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Facpi%2Fasus_acpi.c;h=839f423d738d8618f8bc444b5707c672f833a5ac;hb=816724e65c72a90a44fbad0ef0b59b186c85fa90;hp=216c072dee5e2bdffa71018b97982ad3c9a49ee8;hpb=b229cf92eee616c7cb5ad8cdb35a19b119f00bc8;p=linux-2.6-omap-h63xx.git diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c index 216c072dee5..839f423d738 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, unsigned long count, void *data); static int -__init asus_proc_add(char *name, proc_writefunc * writefunc, +asus_proc_add(char *name, proc_writefunc * writefunc, proc_readfunc * readfunc, mode_t mode, struct acpi_device *device) { @@ -836,7 +836,7 @@ __init asus_proc_add(char *name, proc_writefunc * writefunc, return 0; } -static int __init asus_hotk_add_fs(struct acpi_device *device) +static int asus_hotk_add_fs(struct acpi_device *device) { struct proc_dir_entry *proc; mode_t mode; @@ -954,7 +954,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) * This function is used to initialize the hotk with right values. In this * method, we can make all the detection we want, and modify the hotk struct */ -static int __init asus_hotk_get_info(void) +static int asus_hotk_get_info(void) { struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer dsdt = { ACPI_ALLOCATE_BUFFER, NULL }; @@ -1101,7 +1101,7 @@ static int __init asus_hotk_get_info(void) return AE_OK; } -static int __init asus_hotk_check(void) +static int asus_hotk_check(void) { int result = 0; @@ -1119,7 +1119,9 @@ static int __init asus_hotk_check(void) return result; } -static int __init asus_hotk_add(struct acpi_device *device) +static int asus_hotk_found; + +static int asus_hotk_add(struct acpi_device *device) { acpi_status status = AE_OK; int result; @@ -1180,6 +1182,8 @@ static int __init asus_hotk_add(struct acpi_device *device) } } + asus_hotk_found = 1; + end: if (result) { kfree(hotk); @@ -1226,12 +1230,24 @@ static int __init asus_acpi_init(void) asus_proc_dir->owner = THIS_MODULE; result = acpi_bus_register_driver(&asus_hotk_driver); - if (result < 1) { - acpi_bus_unregister_driver(&asus_hotk_driver); + if (result < 0) { remove_proc_entry(PROC_ASUS, acpi_root_dir); return -ENODEV; } + /* + * This is a bit of a kludge. We only want this module loaded + * for ASUS systems, but there's currently no way to probe the + * ACPI namespace for ASUS HIDs. So we just return failure if + * we didn't find one, which will cause the module to be + * unloaded. + */ + if (!asus_hotk_found) { + acpi_bus_unregister_driver(&asus_hotk_driver); + remove_proc_entry(PROC_ASUS, acpi_root_dir); + return result; + } + return 0; }