From: MUNEDA Takahiro Subject: [PATCH 7/7] acpiphp - adds spin_lock/_unlock Date: Fri, 20 Jan 2006 19:08:45 +0900 Message-ID: <87zmlrnrde.wl%muneda.takahiro@jp.fujitsu.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from fgwmail6.fujitsu.co.jp ([192.51.44.36]:17071 "EHLO fgwmail6.fujitsu.co.jp") by vger.kernel.org with ESMTP id S1750796AbWATKJU (ORCPT ); Fri, 20 Jan 2006 05:09:20 -0500 Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: greg@kroah.com, pavel@ucw.cz, kristen.c.accardi@intel.com Cc: pcihpd-discuss@lists.sourceforge.net, linux-acpi@vger.kernel.org, len.brown@intel.com, muneda.takahiro@jp.fujitsu.com This patch adds spin_lock/_unlock to protect slot list_add and list_del. Signed-off-by: MUNEDA Takahiro drivers/pci/hotplug/acpiphp_core.c | 5 +++++ 1 files changed, 5 insertions(+) Index: linux-2.6.16-rc1/drivers/pci/hotplug/acpiphp_core.c =================================================================== --- linux-2.6.16-rc1.orig/drivers/pci/hotplug/acpiphp_core.c +++ 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);