public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bay: Exit if notify handler cannot be installed
@ 2008-05-21 10:45 Holger Macht
  2008-05-21 10:59 ` Matthew Garrett
  0 siblings, 1 reply; 24+ messages in thread
From: Holger Macht @ 2008-05-21 10:45 UTC (permalink / raw)
  To: linux-acpi; +Cc: linux-kernel, kristen.c.accardi, Len Brown

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 <hmacht@suse.de>
---

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


^ permalink raw reply related	[flat|nested] 24+ messages in thread
* [PATCH] bay: Exit if notify handler cannot be installed
@ 2008-05-05 20:25 Holger Macht
  2008-05-06  9:15 ` Holger Macht
  0 siblings, 1 reply; 24+ messages in thread
From: Holger Macht @ 2008-05-05 20:25 UTC (permalink / raw)
  To: linux-acpi; +Cc: linux-kernel, kristen.c.accardi

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. So clean up and exit.

Signed-off-by: Holger Macht <hmacht@suse.de>
---

diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c
index d2fc941..ce9038f 100644
--- a/drivers/acpi/bay.c
+++ b/drivers/acpi/bay.c
@@ -311,6 +311,7 @@ static int bay_add(acpi_handle handle, int id)
 			bay_notify, new_bay);
 	if (ACPI_FAILURE(status)) {
 		printk(KERN_ERR PREFIX "Error installing bay notify handler\n");
+		goto bay_add_err;
 	}
 
 	/* if we are on a dock station, we should register for dock


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2008-05-21 11:03 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 10:45 [PATCH] bay: Exit if notify handler cannot be installed Holger Macht
2008-05-21 10:59 ` Matthew Garrett
2008-05-21 11:06   ` Holger Macht
  -- strict thread matches above, loose matches on Subject: below --
2008-05-05 20:25 Holger Macht
2008-05-06  9:15 ` Holger Macht
2008-05-06  9:23   ` Shaohua Li
2008-05-06  9:33     ` Holger Macht
2008-05-06  9:35       ` Holger Macht
2008-05-06 15:24         ` Henrique de Moraes Holschuh
2008-05-06 17:12           ` Holger Macht
2008-05-07  1:03         ` Shaohua Li
2008-05-06 15:18     ` Henrique de Moraes Holschuh
2008-05-06 15:20       ` Alan Cox
2008-05-06 15:39         ` Henrique de Moraes Holschuh
2008-05-06 15:49           ` Alan Cox
2008-05-06 17:17           ` Holger Macht
2008-05-06 17:13       ` Holger Macht
2008-05-07  1:04       ` Shaohua Li
2008-05-07  1:13         ` Henrique de Moraes Holschuh
2008-05-07  1:27           ` Shaohua Li
2008-05-07 12:37             ` Henrique de Moraes Holschuh
2008-05-07 12:43               ` Henrique de Moraes Holschuh
2008-05-07 13:05               ` Holger Macht
2008-05-07 14:17               ` Matthew Garrett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox