Merge branch 'machtypes' into pxa-palm
[sfrench/cifs-2.6.git] / drivers / acpi / bay.c
index 1fa86811b8ee6ee8e5e675666fc1092f0b4c6eb5..26038c2a2a71bb20026a0631e890b6d57705805e 100644 (file)
@@ -201,6 +201,7 @@ static int is_ejectable_bay(acpi_handle handle)
        return 0;
 }
 
+#if 0
 /**
  * eject_removable_drive - try to eject this drive
  * @dev : the device structure of the drive
@@ -225,6 +226,7 @@ int eject_removable_drive(struct device *dev)
        return 0;
 }
 EXPORT_SYMBOL_GPL(eject_removable_drive);
+#endif  /*  0  */
 
 static int acpi_bay_add_fs(struct bay *bay)
 {
@@ -299,16 +301,20 @@ static int bay_add(acpi_handle handle, int id)
         */
        pdev->dev.uevent_suppress = 0;
 
-       if (acpi_bay_add_fs(new_bay)) {
-               platform_device_unregister(new_bay->pdev);
-               goto bay_add_err;
-       }
-
        /* register for events on this device */
        status = acpi_install_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
                        bay_notify, new_bay);
        if (ACPI_FAILURE(status)) {
-               printk(KERN_ERR PREFIX "Error installing bay notify handler\n");
+               printk(KERN_INFO PREFIX "Error installing bay notify handler\n");
+               platform_device_unregister(new_bay->pdev);
+               goto bay_add_err;
+       }
+
+       if (acpi_bay_add_fs(new_bay)) {
+               acpi_remove_notify_handler(handle, ACPI_SYSTEM_NOTIFY,
+                                          bay_notify);
+               platform_device_unregister(new_bay->pdev);
+               goto bay_add_err;
        }
 
        /* if we are on a dock station, we should register for dock