aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2006-01-13 12:27:11 -0500
committerJames Bottomley <jejb@mulgrave.(none)>2006-01-14 11:54:57 -0500
commiteeb846cefdd842af479393a7d0fd399a29e42532 (patch)
treeee8ec36c7ce0c259b52de7b4185013082b061d14
parent9a28f49adbe4955af8a1306fd36ddae15136dde7 (diff)
[SCSI] fusion: convert semaphores to mutexes
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r--drivers/message/fusion/mptbase.h4
-rw-r--r--drivers/message/fusion/mptctl.c12
-rw-r--r--drivers/message/fusion/mptsas.c6
3 files changed, 11 insertions, 11 deletions
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index af9007d498ee..74355f2eca00 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -413,7 +413,7 @@ typedef struct _MPT_IOCTL {
413 u8 status; /* current command status */ 413 u8 status; /* current command status */
414 u8 reset; /* 1 if bus reset allowed */ 414 u8 reset; /* 1 if bus reset allowed */
415 u8 target; /* target for reset */ 415 u8 target; /* target for reset */
416 struct semaphore sem_ioc; 416 struct mutex ioctl_mutex;
417} MPT_IOCTL; 417} MPT_IOCTL;
418 418
419#define MPT_SAS_MGMT_STATUS_RF_VALID 0x02 /* The Reply Frame is VALID */ 419#define MPT_SAS_MGMT_STATUS_RF_VALID 0x02 /* The Reply Frame is VALID */
@@ -421,7 +421,7 @@ typedef struct _MPT_IOCTL {
421#define MPT_SAS_MGMT_STATUS_TM_FAILED 0x40 /* User TM request failed */ 421#define MPT_SAS_MGMT_STATUS_TM_FAILED 0x40 /* User TM request failed */
422 422
423typedef struct _MPT_SAS_MGMT { 423typedef struct _MPT_SAS_MGMT {
424 struct semaphore mutex; 424 struct mutex mutex;
425 struct completion done; 425 struct completion done;
426 u8 reply[MPT_DEFAULT_FRAME_SIZE]; /* reply frame data */ 426 u8 reply[MPT_DEFAULT_FRAME_SIZE]; /* reply frame data */
427 u8 status; /* current command status */ 427 u8 status; /* current command status */
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index 7c340240a50e..bdf709987982 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -177,10 +177,10 @@ mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
177 dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down(%p,%d) called\n", ioc, nonblock)); 177 dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down(%p,%d) called\n", ioc, nonblock));
178 178
179 if (nonblock) { 179 if (nonblock) {
180 if (down_trylock(&ioc->ioctl->sem_ioc)) 180 if (!mutex_trylock(&ioc->ioctl->ioctl_mutex))
181 rc = -EAGAIN; 181 rc = -EAGAIN;
182 } else { 182 } else {
183 if (down_interruptible(&ioc->ioctl->sem_ioc)) 183 if (mutex_lock_interruptible(&ioc->ioctl->ioctl_mutex))
184 rc = -ERESTARTSYS; 184 rc = -ERESTARTSYS;
185 } 185 }
186 dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down return %d\n", rc)); 186 dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down return %d\n", rc));
@@ -557,7 +557,7 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
557 else 557 else
558 ret = -EINVAL; 558 ret = -EINVAL;
559 559
560 up(&iocp->ioctl->sem_ioc); 560 mutex_unlock(&iocp->ioctl->ioctl_mutex);
561 561
562 return ret; 562 return ret;
563} 563}
@@ -2619,7 +2619,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
2619 2619
2620 ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen); 2620 ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen);
2621 2621
2622 up(&iocp->ioctl->sem_ioc); 2622 mutex_unlock(&iocp->ioctl->ioctl_mutex);
2623 2623
2624 return ret; 2624 return ret;
2625} 2625}
@@ -2673,7 +2673,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
2673 */ 2673 */
2674 ret = mptctl_do_mpt_command (karg, &uarg->MF); 2674 ret = mptctl_do_mpt_command (karg, &uarg->MF);
2675 2675
2676 up(&iocp->ioctl->sem_ioc); 2676 mutex_unlock(&iocp->ioctl->ioctl_mutex);
2677 2677
2678 return ret; 2678 return ret;
2679} 2679}
@@ -2743,7 +2743,7 @@ mptctl_probe(struct pci_dev *pdev, const struct pci_device_id *id)
2743 memset(mem, 0, sz); 2743 memset(mem, 0, sz);
2744 ioc->ioctl = (MPT_IOCTL *) mem; 2744 ioc->ioctl = (MPT_IOCTL *) mem;
2745 ioc->ioctl->ioc = ioc; 2745 ioc->ioctl->ioc = ioc;
2746 sema_init(&ioc->ioctl->sem_ioc, 1); 2746 mutex_init(&ioc->ioctl->ioctl_mutex);
2747 return 0; 2747 return 0;
2748 2748
2749out_fail: 2749out_fail:
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index b2c682fe634f..19fc03ecdf60 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -457,7 +457,7 @@ static int mptsas_phy_reset(struct sas_phy *phy, int hard_reset)
457 if (phy->identify.target_port_protocols & SAS_PROTOCOL_SMP) 457 if (phy->identify.target_port_protocols & SAS_PROTOCOL_SMP)
458 return -ENXIO; 458 return -ENXIO;
459 459
460 if (down_interruptible(&ioc->sas_mgmt.mutex)) 460 if (mutex_lock_interruptible(&ioc->sas_mgmt.mutex))
461 goto out; 461 goto out;
462 462
463 mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc); 463 mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc);
@@ -508,7 +508,7 @@ static int mptsas_phy_reset(struct sas_phy *phy, int hard_reset)
508 error = 0; 508 error = 0;
509 509
510 out_unlock: 510 out_unlock:
511 up(&ioc->sas_mgmt.mutex); 511 mutex_unlock(&ioc->sas_mgmt.mutex);
512 out: 512 out:
513 return error; 513 return error;
514} 514}
@@ -1477,7 +1477,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1477 INIT_LIST_HEAD(&ioc->sas_topology); 1477 INIT_LIST_HEAD(&ioc->sas_topology);
1478 mutex_init(&ioc->sas_topology_mutex); 1478 mutex_init(&ioc->sas_topology_mutex);
1479 1479
1480 init_MUTEX(&ioc->sas_mgmt.mutex); 1480 mutex_init(&ioc->sas_mgmt.mutex);
1481 init_completion(&ioc->sas_mgmt.done); 1481 init_completion(&ioc->sas_mgmt.done);
1482 1482
1483 /* Verify that we won't exceed the maximum 1483 /* Verify that we won't exceed the maximum