]> nv-tegra.nvidia Code Review - linux-3.10.git/blobdiff - drivers/acpi/asus_acpi.c
asus_acpi: fix oops on non-asus machines
[linux-3.10.git] / drivers / acpi / asus_acpi.c
index fa19a6c95501c7a03cc9051847951f20d134a4c7..3cd79caad70c5c56f1da00ea016109e0b940e1d1 100644 (file)
@@ -431,7 +431,7 @@ static struct asus_hotk *hotk;
 static int asus_hotk_add(struct acpi_device *device);
 static int asus_hotk_remove(struct acpi_device *device, int type);
 static struct acpi_driver asus_hotk_driver = {
-       .name = ACPI_HOTK_NAME,
+       .name = "asus_acpi",
        .class = ACPI_HOTK_CLASS,
        .ids = ACPI_HOTK_HID,
        .ops = {
@@ -848,7 +848,7 @@ out:
 
 static int set_brightness_status(struct backlight_device *bd)
 {
-       return set_brightness(bd->props->brightness);
+       return set_brightness(bd->props.brightness);
 }
 
 static int
@@ -1352,14 +1352,12 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
        return 0;
 }
 
-static struct backlight_properties asus_backlight_data = {
-        .owner          = THIS_MODULE,
+static struct backlight_ops asus_backlight_data = {
         .get_brightness = read_brightness,
         .update_status  = set_brightness_status,
-        .max_brightness = 15,
 };
 
-static void __exit asus_acpi_exit(void)
+static void asus_acpi_exit(void)
 {
        if (asus_backlight_device)
                backlight_device_unregister(asus_backlight_device);
@@ -1377,10 +1375,6 @@ static int __init asus_acpi_init(void)
        if (acpi_disabled)
                return -ENODEV;
 
-       if (!acpi_specific_hotkey_enabled) {
-               printk(KERN_ERR "Using generic hotkey driver\n");
-               return -ENODEV;
-       }
        asus_proc_dir = proc_mkdir(PROC_ASUS, acpi_root_dir);
        if (!asus_proc_dir) {
                printk(KERN_ERR "Asus ACPI: Unable to create /proc entry\n");
@@ -1404,7 +1398,7 @@ static int __init asus_acpi_init(void)
        if (!asus_hotk_found) {
                acpi_bus_unregister_driver(&asus_hotk_driver);
                remove_proc_entry(PROC_ASUS, acpi_root_dir);
-               return result;
+               return -ENODEV;
        }
 
        asus_backlight_device = backlight_device_register("asus",NULL,NULL,
@@ -1413,7 +1407,9 @@ static int __init asus_acpi_init(void)
                printk(KERN_ERR "Could not register asus backlight device\n");
                asus_backlight_device = NULL;
                asus_acpi_exit();
+               return -ENODEV;
        }
+        asus_backlight_device->props.max_brightness = 15;
 
        return 0;
 }