aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/sgi_hotplug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/sgi_hotplug.c')
-rw-r--r--drivers/pci/hotplug/sgi_hotplug.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c
index c402da8e78ae..8cb9abde736b 100644
--- a/drivers/pci/hotplug/sgi_hotplug.c
+++ b/drivers/pci/hotplug/sgi_hotplug.c
@@ -15,6 +15,7 @@
15#include <linux/pci.h> 15#include <linux/pci.h>
16#include <linux/proc_fs.h> 16#include <linux/proc_fs.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/mutex.h>
18 19
19#include <asm/sn/addrs.h> 20#include <asm/sn/addrs.h>
20#include <asm/sn/l1.h> 21#include <asm/sn/l1.h>
@@ -81,7 +82,7 @@ static struct hotplug_slot_ops sn_hotplug_slot_ops = {
81 .get_power_status = get_power_status, 82 .get_power_status = get_power_status,
82}; 83};
83 84
84static DECLARE_MUTEX(sn_hotplug_sem); 85static DEFINE_MUTEX(sn_hotplug_mutex);
85 86
86static ssize_t path_show (struct hotplug_slot *bss_hotplug_slot, 87static ssize_t path_show (struct hotplug_slot *bss_hotplug_slot,
87 char *buf) 88 char *buf)
@@ -346,7 +347,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
346 int rc; 347 int rc;
347 348
348 /* Serialize the Linux PCI infrastructure */ 349 /* Serialize the Linux PCI infrastructure */
349 down(&sn_hotplug_sem); 350 mutex_lock(&sn_hotplug_mutex);
350 351
351 /* 352 /*
352 * Power-on and initialize the slot in the SN 353 * Power-on and initialize the slot in the SN
@@ -354,7 +355,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
354 */ 355 */
355 rc = sn_slot_enable(bss_hotplug_slot, slot->device_num); 356 rc = sn_slot_enable(bss_hotplug_slot, slot->device_num);
356 if (rc) { 357 if (rc) {
357 up(&sn_hotplug_sem); 358 mutex_unlock(&sn_hotplug_mutex);
358 return rc; 359 return rc;
359 } 360 }
360 361
@@ -362,7 +363,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
362 PCI_DEVFN(slot->device_num + 1, 0)); 363 PCI_DEVFN(slot->device_num + 1, 0));
363 if (!num_funcs) { 364 if (!num_funcs) {
364 dev_dbg(slot->pci_bus->self, "no device in slot\n"); 365 dev_dbg(slot->pci_bus->self, "no device in slot\n");
365 up(&sn_hotplug_sem); 366 mutex_unlock(&sn_hotplug_mutex);
366 return -ENODEV; 367 return -ENODEV;
367 } 368 }
368 369
@@ -402,7 +403,7 @@ static int enable_slot(struct hotplug_slot *bss_hotplug_slot)
402 if (new_ppb) 403 if (new_ppb)
403 pci_bus_add_devices(new_bus); 404 pci_bus_add_devices(new_bus);
404 405
405 up(&sn_hotplug_sem); 406 mutex_unlock(&sn_hotplug_mutex);
406 407
407 if (rc == 0) 408 if (rc == 0)
408 dev_dbg(slot->pci_bus->self, 409 dev_dbg(slot->pci_bus->self,
@@ -422,7 +423,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
422 int rc; 423 int rc;
423 424
424 /* Acquire update access to the bus */ 425 /* Acquire update access to the bus */
425 down(&sn_hotplug_sem); 426 mutex_lock(&sn_hotplug_mutex);
426 427
427 /* is it okay to bring this slot down? */ 428 /* is it okay to bring this slot down? */
428 rc = sn_slot_disable(bss_hotplug_slot, slot->device_num, 429 rc = sn_slot_disable(bss_hotplug_slot, slot->device_num,
@@ -450,7 +451,7 @@ static int disable_slot(struct hotplug_slot *bss_hotplug_slot)
450 PCI_REQ_SLOT_DISABLE); 451 PCI_REQ_SLOT_DISABLE);
451 leaving: 452 leaving:
452 /* Release the bus lock */ 453 /* Release the bus lock */
453 up(&sn_hotplug_sem); 454 mutex_unlock(&sn_hotplug_mutex);
454 455
455 return rc; 456 return rc;
456} 457}
@@ -462,9 +463,9 @@ static inline int get_power_status(struct hotplug_slot *bss_hotplug_slot,
462 struct pcibus_info *pcibus_info; 463 struct pcibus_info *pcibus_info;
463 464
464 pcibus_info = SN_PCIBUS_BUSSOFT_INFO(slot->pci_bus); 465 pcibus_info = SN_PCIBUS_BUSSOFT_INFO(slot->pci_bus);
465 down(&sn_hotplug_sem); 466 mutex_lock(&sn_hotplug_mutex);
466 *value = pcibus_info->pbi_enabled_devices & (1 << slot->device_num); 467 *value = pcibus_info->pbi_enabled_devices & (1 << slot->device_num);
467 up(&sn_hotplug_sem); 468 mutex_unlock(&sn_hotplug_mutex);
468 return 0; 469 return 0;
469} 470}
470 471