Pull auto-load-modules into release branch
[pandora-kernel.git] / drivers / misc / asus-laptop.c
index 4f9060a..d0fc4fd 100644 (file)
@@ -53,7 +53,6 @@
 #define ASUS_HOTK_NAME          "Asus Laptop Support"
 #define ASUS_HOTK_CLASS         "hotkey"
 #define ASUS_HOTK_DEVICE_NAME   "Hotkey"
-#define ASUS_HOTK_HID           "ATK0100"
 #define ASUS_HOTK_FILE          "asus-laptop"
 #define ASUS_HOTK_PREFIX        "\\_SB.ATKD."
 
@@ -197,12 +196,18 @@ static struct asus_hotk *hotk;
 /*
  * The hotkey driver declaration
  */
+static const struct acpi_device_id asus_device_ids[] = {
+       {"ATK0100", 0},
+       {"", 0},
+};
+MODULE_DEVICE_TABLE(acpi, asus_device_ids);
+
 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 = ASUS_HOTK_NAME,
        .class = ASUS_HOTK_CLASS,
-       .ids = ASUS_HOTK_HID,
+       .ids = asus_device_ids,
        .ops = {
                .add = asus_hotk_add,
                .remove = asus_hotk_remove,
@@ -737,8 +742,7 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
        struct device_attribute dev_attr_##_name = {                    \
                .attr = {                                               \
                        .name = __stringify(_name),                     \
-                       .mode = 0,                                      \
-                       .owner = THIS_MODULE },                         \
+                       .mode = 0 },                                    \
                .show   = NULL,                                         \
                .store  = NULL,                                         \
        }
@@ -980,10 +984,9 @@ static int asus_hotk_add(struct acpi_device *device)
        printk(ASUS_NOTICE "Asus Laptop Support version %s\n",
               ASUS_LAPTOP_VERSION);
 
-       hotk = kmalloc(sizeof(struct asus_hotk), GFP_KERNEL);
+       hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL);
        if (!hotk)
                return -ENOMEM;
-       memset(hotk, 0, sizeof(struct asus_hotk));
 
        hotk->handle = device->handle;
        strcpy(acpi_device_name(device), ASUS_HOTK_DEVICE_NAME);
@@ -1069,19 +1072,16 @@ static void asus_backlight_exit(void)
 }
 
 #define  ASUS_LED_UNREGISTER(object)                           \
-       if(object##_led.class_dev                               \
-          && !IS_ERR(object##_led.class_dev))                  \
-               led_classdev_unregister(&object##_led)
+       led_classdev_unregister(&object##_led)
 
 static void asus_led_exit(void)
 {
+       destroy_workqueue(led_workqueue);
        ASUS_LED_UNREGISTER(mled);
        ASUS_LED_UNREGISTER(tled);
        ASUS_LED_UNREGISTER(pled);
        ASUS_LED_UNREGISTER(rled);
        ASUS_LED_UNREGISTER(gled);
-
-       destroy_workqueue(led_workqueue);
 }
 
 static void __exit asus_laptop_exit(void)
@@ -1137,29 +1137,42 @@ static int asus_led_init(struct device *dev)
 
        rv = ASUS_LED_REGISTER(mled, dev);
        if (rv)
-               return rv;
+               goto out;
 
        rv = ASUS_LED_REGISTER(tled, dev);
        if (rv)
-               return rv;
+               goto out1;
 
        rv = ASUS_LED_REGISTER(rled, dev);
        if (rv)
-               return rv;
+               goto out2;
 
        rv = ASUS_LED_REGISTER(pled, dev);
        if (rv)
-               return rv;
+               goto out3;
 
        rv = ASUS_LED_REGISTER(gled, dev);
        if (rv)
-               return rv;
+               goto out4;
 
        led_workqueue = create_singlethread_workqueue("led_workqueue");
        if (!led_workqueue)
-               return -ENOMEM;
+               goto out5;
 
        return 0;
+out5:
+       rv = -ENOMEM;
+       ASUS_LED_UNREGISTER(gled);
+out4:
+       ASUS_LED_UNREGISTER(pled);
+out3:
+       ASUS_LED_UNREGISTER(rled);
+out2:
+       ASUS_LED_UNREGISTER(tled);
+out1:
+       ASUS_LED_UNREGISTER(mled);
+out:
+       return rv;
 }
 
 static int __init asus_laptop_init(void)