[RFC PATCH 10/11] PCI,ACPI: serialize hotplug operations triggered by ACPI subsystem

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

 



Use pci_lock_hotplug()/pci_unlock_hotplug() to serialize PCI
hotplug operations related to ACPI root bridges.

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

diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 24afd66..a8a3867 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -463,6 +463,8 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
 	if (!root)
 		return -ENOMEM;
 
+	pci_lock_hotplug();
+
 	segment = 0;
 	status = acpi_evaluate_integer(device->handle, METHOD_NAME__SEG, NULL,
 				       &segment);
@@ -627,12 +629,14 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device)
 			driver->add(device->handle);
 
 	mutex_unlock(&acpi_pci_root_lock);
+	pci_unlock_hotplug();
 
 	return 0;
 
 out_del_root:
 	list_del_rcu(&root->node);
 	mutex_unlock(&acpi_pci_root_lock);
+	pci_unlock_hotplug();
 	synchronize_rcu();
 out_free:
 	kfree(root);
@@ -643,7 +647,9 @@ static int acpi_pci_root_start(struct acpi_device *device)
 {
 	struct acpi_pci_root *root = acpi_driver_data(device);
 
+	pci_lock_hotplug();
 	pci_bus_add_devices(root->bus);
+	pci_unlock_hotplug();
 	return 0;
 }
 
@@ -652,6 +658,7 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type)
 	struct acpi_pci_root *root = acpi_driver_data(device);
 	struct acpi_pci_driver *driver;
 
+	pci_lock_hotplug();
 	mutex_lock(&acpi_pci_root_lock);
 
 	list_for_each_entry(driver, &acpi_pci_drivers, node)
@@ -675,6 +682,7 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type)
 out:
 	list_del_rcu(&root->node);
 	mutex_unlock(&acpi_pci_root_lock);
+	pci_unlock_hotplug();
 	synchronize_rcu();
 	kfree(root);
 
-- 
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