[RFC PATCH 11/11] PCI: Serialize hotplug operations triggered by acpiphp driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



User pci_lock_hotplug()/pci_unlock_hotplug() to serialize PCI
hotplug operations triggered by acpiphp driver.

Signed-off-by: Jiang Liu <jiang.liu@xxxxxxxxxx>
---
 drivers/pci/hotplug/acpiphp_glue.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 764891e..ee820a9 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -1095,6 +1095,8 @@ static void _handle_hotplug_event_bridge(struct work_struct *work)
 	handle = hp_work->handle;
 	type = hp_work->type;
 	bridge = (struct acpiphp_bridge *)hp_work->context;
+
+	pci_lock_hotplug();
 	if (bridge->flags & BRIDGE_IS_DEAD)
 		goto out;
 
@@ -1156,6 +1158,7 @@ static void _handle_hotplug_event_bridge(struct work_struct *work)
 	}
 
 out:
+	pci_unlock_hotplug();
 	kref_put(&bridge->kref, acpiphp_release_bridge);
 	kfree(hp_work); /* allocated in handle_hotplug_event_bridge */
 }
@@ -1201,6 +1204,8 @@ static void _handle_hotplug_event_func(struct work_struct *work)
 	handle = hp_work->handle;
 	type = hp_work->type;
 	func = (struct acpiphp_func *)hp_work->context;
+
+	pci_lock_hotplug();
 	if (func->flags & FUNC_IS_DEAD)
 		goto out;
 
@@ -1237,6 +1242,7 @@ static void _handle_hotplug_event_func(struct work_struct *work)
 	}
 
 out:
+	pci_unlock_hotplug();
 	kref_put(&func->kref, acpiphp_release_func);
 	kfree(hp_work); /* allocated in handle_hotplug_event_func */
 }
-- 
1.7.5.4

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux