Commit eeb846ce authored by Christoph Hellwig's avatar Christoph Hellwig Committed by James Bottomley

[SCSI] fusion: convert semaphores to mutexes

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 9a28f49a
...@@ -413,7 +413,7 @@ typedef struct _MPT_IOCTL { ...@@ -413,7 +413,7 @@ typedef struct _MPT_IOCTL {
u8 status; /* current command status */ u8 status; /* current command status */
u8 reset; /* 1 if bus reset allowed */ u8 reset; /* 1 if bus reset allowed */
u8 target; /* target for reset */ u8 target; /* target for reset */
struct semaphore sem_ioc; struct mutex ioctl_mutex;
} MPT_IOCTL; } MPT_IOCTL;
#define MPT_SAS_MGMT_STATUS_RF_VALID 0x02 /* The Reply Frame is VALID */ #define MPT_SAS_MGMT_STATUS_RF_VALID 0x02 /* The Reply Frame is VALID */
...@@ -421,7 +421,7 @@ typedef struct _MPT_IOCTL { ...@@ -421,7 +421,7 @@ typedef struct _MPT_IOCTL {
#define MPT_SAS_MGMT_STATUS_TM_FAILED 0x40 /* User TM request failed */ #define MPT_SAS_MGMT_STATUS_TM_FAILED 0x40 /* User TM request failed */
typedef struct _MPT_SAS_MGMT { typedef struct _MPT_SAS_MGMT {
struct semaphore mutex; struct mutex mutex;
struct completion done; struct completion done;
u8 reply[MPT_DEFAULT_FRAME_SIZE]; /* reply frame data */ u8 reply[MPT_DEFAULT_FRAME_SIZE]; /* reply frame data */
u8 status; /* current command status */ u8 status; /* current command status */
......
...@@ -177,10 +177,10 @@ mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock) ...@@ -177,10 +177,10 @@ mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down(%p,%d) called\n", ioc, nonblock)); dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down(%p,%d) called\n", ioc, nonblock));
if (nonblock) { if (nonblock) {
if (down_trylock(&ioc->ioctl->sem_ioc)) if (!mutex_trylock(&ioc->ioctl->ioctl_mutex))
rc = -EAGAIN; rc = -EAGAIN;
} else { } else {
if (down_interruptible(&ioc->ioctl->sem_ioc)) if (mutex_lock_interruptible(&ioc->ioctl->ioctl_mutex))
rc = -ERESTARTSYS; rc = -ERESTARTSYS;
} }
dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down return %d\n", rc)); 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,7 +557,7 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
else else
ret = -EINVAL; ret = -EINVAL;
up(&iocp->ioctl->sem_ioc); mutex_unlock(&iocp->ioctl->ioctl_mutex);
return ret; return ret;
} }
...@@ -2619,7 +2619,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd, ...@@ -2619,7 +2619,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen); ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen);
up(&iocp->ioctl->sem_ioc); mutex_unlock(&iocp->ioctl->ioctl_mutex);
return ret; return ret;
} }
...@@ -2673,7 +2673,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd, ...@@ -2673,7 +2673,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
*/ */
ret = mptctl_do_mpt_command (karg, &uarg->MF); ret = mptctl_do_mpt_command (karg, &uarg->MF);
up(&iocp->ioctl->sem_ioc); mutex_unlock(&iocp->ioctl->ioctl_mutex);
return ret; return ret;
} }
...@@ -2743,7 +2743,7 @@ mptctl_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -2743,7 +2743,7 @@ mptctl_probe(struct pci_dev *pdev, const struct pci_device_id *id)
memset(mem, 0, sz); memset(mem, 0, sz);
ioc->ioctl = (MPT_IOCTL *) mem; ioc->ioctl = (MPT_IOCTL *) mem;
ioc->ioctl->ioc = ioc; ioc->ioctl->ioc = ioc;
sema_init(&ioc->ioctl->sem_ioc, 1); mutex_init(&ioc->ioctl->ioctl_mutex);
return 0; return 0;
out_fail: out_fail:
......
...@@ -457,7 +457,7 @@ static int mptsas_phy_reset(struct sas_phy *phy, int hard_reset) ...@@ -457,7 +457,7 @@ static int mptsas_phy_reset(struct sas_phy *phy, int hard_reset)
if (phy->identify.target_port_protocols & SAS_PROTOCOL_SMP) if (phy->identify.target_port_protocols & SAS_PROTOCOL_SMP)
return -ENXIO; return -ENXIO;
if (down_interruptible(&ioc->sas_mgmt.mutex)) if (mutex_lock_interruptible(&ioc->sas_mgmt.mutex))
goto out; goto out;
mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc); mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc);
...@@ -508,7 +508,7 @@ static int mptsas_phy_reset(struct sas_phy *phy, int hard_reset) ...@@ -508,7 +508,7 @@ static int mptsas_phy_reset(struct sas_phy *phy, int hard_reset)
error = 0; error = 0;
out_unlock: out_unlock:
up(&ioc->sas_mgmt.mutex); mutex_unlock(&ioc->sas_mgmt.mutex);
out: out:
return error; return error;
} }
...@@ -1477,7 +1477,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -1477,7 +1477,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
INIT_LIST_HEAD(&ioc->sas_topology); INIT_LIST_HEAD(&ioc->sas_topology);
mutex_init(&ioc->sas_topology_mutex); mutex_init(&ioc->sas_topology_mutex);
init_MUTEX(&ioc->sas_mgmt.mutex); mutex_init(&ioc->sas_mgmt.mutex);
init_completion(&ioc->sas_mgmt.done); init_completion(&ioc->sas_mgmt.done);
/* Verify that we won't exceed the maximum /* Verify that we won't exceed the maximum
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment