Skip to contentSkip to conversation

acpiphp - adds spin_lock/_unlock

PATCH In review MUNEDA Takahiro 1 participant 1 message Jan 20, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 7/7 acpiphp - adds spin_lock/_unlock

This patch adds spin_lock/_unlock to protect slot list_add and list_del.

 drivers/pci/hotplug/acpiphp_core.c |    5 +++++
 1 files changed, 5 insertions(+)
drivers/pci/hotplug/acpiphp_core.c +5 -0
Index: linux-2.6.16-rc1/drivers/pci/hotplug/acpiphp_core.c
===================================================================
@@ -45,6 +45,7 @@
 #include "acpiphp.h"
 
 static LIST_HEAD(slot_list);
+static DEFINE_SPINLOCK(list_lock);
 
 #define MY_NAME	"acpiphp"
 
@@ -387,7 +388,9 @@ int acpiphp_register_hotplug_slot(struct
 	}
 
 	/* add slot to our internal list */
+	spin_lock(&list_lock);
 	list_add(&slot->slot_list, &slot_list);
+	spin_unlock(&list_lock);
 	info("Slot [%s] registered\n", slot->hotplug_slot->name);
 
 	return 0;
@@ -416,7 +419,9 @@ void acpiphp_unregister_hotplug_slot(str
 		if (slot->acpi_slot->sun != acpiphp_slot->sun)
 			continue;
 
+		spin_lock(&list_lock);
 		list_del(&slot->slot_list);
+		spin_unlock(&list_lock);
 		info ("Slot [%s] unregistered\n", slot->hotplug_slot->name);
 
 		retval = pci_hp_deregister(slot->hotplug_slot);