aboutsummaryrefslogtreecommitdiff
path: root/drivers/sn
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2006-03-21 08:17:15 -0800
committerTony Luck <tony.luck@intel.com>2006-03-21 08:17:15 -0800
commit6a8a8e14bed179f2d415c7f4fee51233c35c10c3 (patch)
tree2b83cc2f044237c8b7c3e14b5a70c4905f0050a3 /drivers/sn
parent33cbd30eaf24ea43af4fe161b6fb34a859b3f2e0 (diff)
parent6e586f32931d6c98431d54cd0430d4366195b0ba (diff)
Pull sem2mutex-ioc4 into release branch
Diffstat (limited to 'drivers/sn')
-rw-r--r--drivers/sn/ioc4.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/drivers/sn/ioc4.c b/drivers/sn/ioc4.c
index ea75b3d0612..67140a5804f 100644
--- a/drivers/sn/ioc4.c
+++ b/drivers/sn/ioc4.c
@@ -31,7 +31,7 @@
#include <linux/ioc4.h>
#include <linux/mmtimer.h>
#include <linux/rtc.h>
-#include <linux/rwsem.h>
+#include <linux/mutex.h>
#include <asm/sn/addrs.h>
#include <asm/sn/clksupport.h>
#include <asm/sn/shub_mmr.h>
@@ -54,11 +54,10 @@
* Submodule management *
************************/
-static LIST_HEAD(ioc4_devices);
-static DECLARE_RWSEM(ioc4_devices_rwsem);
+static DEFINE_MUTEX(ioc4_mutex);
+static LIST_HEAD(ioc4_devices);
static LIST_HEAD(ioc4_submodules);
-static DECLARE_RWSEM(ioc4_submodules_rwsem);
/* Register an IOC4 submodule */
int
@@ -66,15 +65,13 @@ ioc4_register_submodule(struct ioc4_submodule *is)
{
struct ioc4_driver_data *idd;
- down_write(&ioc4_submodules_rwsem);
+ mutex_lock(&ioc4_mutex);
list_add(&is->is_list, &ioc4_submodules);
- up_write(&ioc4_submodules_rwsem);
/* Initialize submodule for each IOC4 */
if (!is->is_probe)
- return 0;
+ goto out;
- down_read(&ioc4_devices_rwsem);
list_for_each_entry(idd, &ioc4_devices, idd_list) {
if (is->is_probe(idd)) {
printk(KERN_WARNING
@@ -84,8 +81,8 @@ ioc4_register_submodule(struct ioc4_submodule *is)
pci_name(idd->idd_pdev));
}
}
- up_read(&ioc4_devices_rwsem);
-
+ out:
+ mutex_unlock(&ioc4_mutex);
return 0;
}
@@ -95,15 +92,13 @@ ioc4_unregister_submodule(struct ioc4_submodule *is)
{
struct ioc4_driver_data *idd;
- down_write(&ioc4_submodules_rwsem);
+ mutex_lock(&ioc4_mutex);
list_del(&is->is_list);
- up_write(&ioc4_submodules_rwsem);
/* Remove submodule for each IOC4 */
if (!is->is_remove)
- return;
+ goto out;
- down_read(&ioc4_devices_rwsem);
list_for_each_entry(idd, &ioc4_devices, idd_list) {
if (is->is_remove(idd)) {
printk(KERN_WARNING
@@ -113,7 +108,8 @@ ioc4_unregister_submodule(struct ioc4_submodule *is)
pci_name(idd->idd_pdev));
}
}
- up_read(&ioc4_devices_rwsem);
+ out:
+ mutex_unlock(&ioc4_mutex);
}
/*********************
@@ -312,12 +308,11 @@ ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
/* Track PCI-device specific data */
idd->idd_serial_data = NULL;
pci_set_drvdata(idd->idd_pdev, idd);
- down_write(&ioc4_devices_rwsem);
+
+ mutex_lock(&ioc4_mutex);
list_add(&idd->idd_list, &ioc4_devices);
- up_write(&ioc4_devices_rwsem);
/* Add this IOC4 to all submodules */
- down_read(&ioc4_submodules_rwsem);
list_for_each_entry(is, &ioc4_submodules, is_list) {
if (is->is_probe && is->is_probe(idd)) {
printk(KERN_WARNING
@@ -327,7 +322,7 @@ ioc4_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)
pci_name(idd->idd_pdev));
}
}
- up_read(&ioc4_submodules_rwsem);
+ mutex_unlock(&ioc4_mutex);
return 0;
@@ -351,7 +346,7 @@ ioc4_remove(struct pci_dev *pdev)
idd = pci_get_drvdata(pdev);
/* Remove this IOC4 from all submodules */
- down_read(&ioc4_submodules_rwsem);
+ mutex_lock(&ioc4_mutex);
list_for_each_entry(is, &ioc4_submodules, is_list) {
if (is->is_remove && is->is_remove(idd)) {
printk(KERN_WARNING
@@ -361,7 +356,7 @@ ioc4_remove(struct pci_dev *pdev)
pci_name(idd->idd_pdev));
}
}
- up_read(&ioc4_submodules_rwsem);
+ mutex_unlock(&ioc4_mutex);
/* Release resources */
iounmap(idd->idd_misc_regs);
@@ -377,9 +372,9 @@ ioc4_remove(struct pci_dev *pdev)
pci_disable_device(pdev);
/* Remove and free driver data */
- down_write(&ioc4_devices_rwsem);
+ mutex_lock(&ioc4_mutex);
list_del(&idd->idd_list);
- up_write(&ioc4_devices_rwsem);
+ mutex_unlock(&ioc4_mutex);
kfree(idd);
}