From 7efd52a407bed6a2b02015b8ebbff7beba155392 Mon Sep 17 00:00:00 2001 From: Holger Macht Date: Mon, 9 Jun 2008 16:22:24 -0700 Subject: bay: exit if notify handler cannot be installed If acpi_install_notify_handler() for a bay device fails, the bay driver is superfluous. Most likely, another driver (like libata) is already caring about this device anyway. Furthermore, register_hotplug_dock_device(acpi_handle) from the dock driver must not be called twice with the same handler. This would result in an endless loop consuming 100% of CPU. So clean up and exit. Signed-off-by: Holger Macht Signed-off-by: Andrew Morton Signed-off-by: Len Brown --- drivers/acpi/bay.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'drivers/acpi/bay.c') diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c index d2fc941..26038c2 100644 --- a/drivers/acpi/bay.c +++ b/drivers/acpi/bay.c @@ -301,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 -- cgit v1.1 From 816c2eda3ce8fa7eb62f22e01e2ec7a3f7d677c0 Mon Sep 17 00:00:00 2001 From: Len Brown Date: Tue, 24 Jun 2008 22:57:12 -0400 Subject: dock: bay: Don't call acpi_walk_namespace() when ACPI is disabled. Signed-off-by: Len Brown --- drivers/acpi/bay.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/acpi/bay.c') diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c index 26038c2..61b6c5b 100644 --- a/drivers/acpi/bay.c +++ b/drivers/acpi/bay.c @@ -377,6 +377,9 @@ static int __init bay_init(void) INIT_LIST_HEAD(&drive_bays); + if (acpi_disabled) + return -ENODEV; + /* look for dockable drive bays */ acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, find_bay, &bays, NULL); -- cgit v1.1