Skip to contentSkip to conversation

bay: exit if notify handler cannot be installed

PATCH NAK [email protected] 4 participants 5 messages Jun 9, 2008 – Jun 11, 2008 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 9/11 bay: exit if notify handler cannot be installed

From: Holger Macht <[email protected]>

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.

Cc Kristen Carlson Accardi <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Thomas Renninger <[email protected]>
Cc Matthew Garrett <[email protected]>
Cc Len Brown <[email protected]>

---

 drivers/acpi/bay.c |   16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)
drivers/acpi/bay.c renamed from drivers/acpi/bay.c~bay-exit-if-notify-handler-cannot-be-installed +10 -6
diff -puN drivers/acpi/bay.c~bay-exit-if-notify-handler-cannot-be-installed drivers/acpi/bay.c
@@ -301,16 +301,20 @@ static int bay_add(acpi_handle handle, i
 	 */
 	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

_

#1 lore raw

It looks like the plan is to subsume the bay driver into the dock driver. I'm not sure if this is needed in the short term until then?

Signature · 1 line
Matthew Garrett | [email protected]
#2 lore raw
Quoted 2 lines · On Tue, 10 Jun 2008 00:28:17 +0100 Matthew Garrett <[email protected]> wrote:

It looks like the plan is to subsume the bay driver into the dock driver. I'm not sure if this is needed in the short term until then?

Dunno.

This patch appears to fix a bug, in which case we shouldn't allow larger future plans to get int he way of that?

#3 lore raw
Quoted 10 lines · Andrew Morton
Quoted 2 lines · On Tue, 10 Jun 2008 00:28:17 +0100 Matthew Garrett <[email protected]> wrote:

It looks like the plan is to subsume the bay driver into the dock driver. I'm not sure if this is needed in the short term until then?

Dunno.

This patch appears to fix a bug, in which case we shouldn't allow larger future plans to get int he way of that?

Right. I don't think we get the bits sorted for removing the bay driver for 2.6.26 IMHO, so this should go in as a bugfix for 2.6.26.

Regards,
Holger

#4 lore raw
Quoted 8 lines · Holger Macht
Quoted 5 lines · Andrew Morton
Quoted 2 lines · On Tue, 10 Jun 2008 00:28:17 +0100 Matthew Garrett <[email protected]> wrote:

It looks like the plan is to subsume the bay driver into the dock driver. I'm not sure if this is needed in the short term until

then?

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

Dunno.

This patch appears to fix a bug, in which case we shouldn't allow larger future plans to get int he way of that?

Right. I don't think we get the bits sorted for removing the bay driver
for 2.6.26 IMHO, so this should go in as a bugfix for 2.6.26.

agree, removing the bay driver isn't 2.6.26 staff.