Pull acpi_bus_register_driver into release branch
[pandora-kernel.git] / drivers / acpi / asus_acpi.c
index 582995e..90eb3c5 100644 (file)
@@ -78,9 +78,9 @@ MODULE_LICENSE("GPL");
 static uid_t asus_uid;
 static gid_t asus_gid;
 module_param(asus_uid, uint, 0);
-MODULE_PARM_DESC(uid, "UID for entries in /proc/acpi/asus.\n");
+MODULE_PARM_DESC(asus_uid, "UID for entries in /proc/acpi/asus.\n");
 module_param(asus_gid, uint, 0);
-MODULE_PARM_DESC(gid, "GID for entries in /proc/acpi/asus.\n");
+MODULE_PARM_DESC(asus_gid, "GID for entries in /proc/acpi/asus.\n");
 
 /* For each model, all features implemented, 
  * those marked with R are relative to HOTK, A for absolute */
@@ -302,7 +302,7 @@ static struct model_data model_conf[END_MODEL] = {
         .brightness_set = "SPLV",
         .brightness_get = "GPLV",
         .display_set = "SDSP",
-        .display_get = "\\SSTE"},
+        .display_get = "\\_SB.PCI0.P0P1.VGA.GETD"},
        {
         .name = "M6R",
         .mt_mled = "MLED",
@@ -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;
@@ -851,6 +851,8 @@ static int __init asus_hotk_add_fs(struct acpi_device *device)
                mode = S_IFREG | S_IRUGO | S_IWUGO;
        } else {
                mode = S_IFREG | S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP;
+               printk(KERN_WARNING "  asus_uid and asus_gid parameters are "
+                      "deprecated, use chown and chmod instead!\n");
        }
 
        acpi_device_dir(device) = asus_proc_dir;
@@ -952,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 };
@@ -968,7 +970,7 @@ static int __init asus_hotk_get_info(void)
         * HID), this bit will be moved. A global variable asus_info contains
         * the DSDT header.
         */
-       status = acpi_get_table(ACPI_TABLE_DSDT, 1, &dsdt);
+       status = acpi_get_table(ACPI_TABLE_ID_DSDT, 1, &dsdt);
        if (ACPI_FAILURE(status))
                printk(KERN_WARNING "  Couldn't get the DSDT table header\n");
        else
@@ -1099,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;
 
@@ -1117,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;
@@ -1178,6 +1182,8 @@ static int __init asus_hotk_add(struct acpi_device *device)
                }
        }
 
+       asus_hotk_found = 1;
+
       end:
        if (result) {
                kfree(hotk);
@@ -1224,7 +1230,19 @@ static int __init asus_acpi_init(void)
        asus_proc_dir->owner = THIS_MODULE;
 
        result = acpi_bus_register_driver(&asus_hotk_driver);
-       if (result < 1) {
+       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 -ENODEV;