diff mbox

eeepc-laptop: disable pci hotplug code when all notifiers fail to load

Message ID 1260738971-25456-1-git-send-email-corentincj@iksaif.net (mailing list archive)
State Superseded, archived
Headers show

Commit Message

Corentin Chary Dec. 13, 2009, 9:16 p.m. UTC
None
diff mbox

Patch

diff --git a/drivers/platform/x86/eeepc-laptop.c b/drivers/platform/x86/eeepc-laptop.c
index 356ca11..45c3f52 100644
--- a/drivers/platform/x86/eeepc-laptop.c
+++ b/drivers/platform/x86/eeepc-laptop.c
@@ -177,6 +177,7 @@  struct eeepc_laptop {
 
 	struct hotplug_slot *hotplug_slot;
 	struct mutex hotplug_lock;
+	bool hotplug_enabled;
 
 	struct led_classdev tpd_led;
 	int tpd_led_wk;
@@ -642,6 +643,7 @@  static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc,
 						     eeepc);
 		if (ACPI_FAILURE(status))
 			pr_warning("Failed to register notify on %s\n", node);
+		eeepc->hotplug_enabled = true;
 	} else
 		return -ENODEV;
 
@@ -845,7 +847,17 @@  static int eeepc_rfkill_init(struct eeepc_laptop *eeepc)
 	if (result && result != -ENODEV)
 		goto exit;
 
-	result = eeepc_setup_pci_hotplug(eeepc);
+	/*
+	 * Register notifiers first, if they all fail, we won't enable
+	 * pci hotplug because it's probably not needed for this model
+	 * (eg: 1005HA)
+	 */
+	eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5");
+	eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6");
+	eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7");
+
+	if (eeepc->hotplug_enabled)
+		result = eeepc_setup_pci_hotplug(eeepc);
 	/*
 	 * If we get -EBUSY then something else is handling the PCI hotplug -
 	 * don't fail in this case
@@ -853,9 +865,6 @@  static int eeepc_rfkill_init(struct eeepc_laptop *eeepc)
 	if (result == -EBUSY)
 		result = 0;
 
-	eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P5");
-	eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P6");
-	eeepc_register_rfkill_notifier(eeepc, "\\_SB.PCI0.P0P7");
 	/*
 	 * Refresh pci hotplug in case the rfkill state was changed during
 	 * setup.