[SCSI] fusion: convert semaphores to mutexes
Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
parent
9a28f49adb
commit
eeb846cefd
|
@ -413,7 +413,7 @@ typedef struct _MPT_IOCTL {
|
|||
u8 status; /* current command status */
|
||||
u8 reset; /* 1 if bus reset allowed */
|
||||
u8 target; /* target for reset */
|
||||
struct semaphore sem_ioc;
|
||||
struct mutex ioctl_mutex;
|
||||
} MPT_IOCTL;
|
||||
|
||||
#define MPT_SAS_MGMT_STATUS_RF_VALID 0x02 /* The Reply Frame is VALID */
|
||||
|
@ -421,7 +421,7 @@ typedef struct _MPT_IOCTL {
|
|||
#define MPT_SAS_MGMT_STATUS_TM_FAILED 0x40 /* User TM request failed */
|
||||
|
||||
typedef struct _MPT_SAS_MGMT {
|
||||
struct semaphore mutex;
|
||||
struct mutex mutex;
|
||||
struct completion done;
|
||||
u8 reply[MPT_DEFAULT_FRAME_SIZE]; /* reply frame data */
|
||||
u8 status; /* current command status */
|
||||
|
|
|
@ -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));
|
||||
|
||||
if (nonblock) {
|
||||
if (down_trylock(&ioc->ioctl->sem_ioc))
|
||||
if (!mutex_trylock(&ioc->ioctl->ioctl_mutex))
|
||||
rc = -EAGAIN;
|
||||
} else {
|
||||
if (down_interruptible(&ioc->ioctl->sem_ioc))
|
||||
if (mutex_lock_interruptible(&ioc->ioctl->ioctl_mutex))
|
||||
rc = -ERESTARTSYS;
|
||||
}
|
||||
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)
|
|||
else
|
||||
ret = -EINVAL;
|
||||
|
||||
up(&iocp->ioctl->sem_ioc);
|
||||
mutex_unlock(&iocp->ioctl->ioctl_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2619,7 +2619,7 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
|
|||
|
||||
ret = mptctl_do_fw_download(kfw.iocnum, kfw.bufp, kfw.fwlen);
|
||||
|
||||
up(&iocp->ioctl->sem_ioc);
|
||||
mutex_unlock(&iocp->ioctl->ioctl_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2673,7 +2673,7 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
|
|||
*/
|
||||
ret = mptctl_do_mpt_command (karg, &uarg->MF);
|
||||
|
||||
up(&iocp->ioctl->sem_ioc);
|
||||
mutex_unlock(&iocp->ioctl->ioctl_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -2743,7 +2743,7 @@ mptctl_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
memset(mem, 0, sz);
|
||||
ioc->ioctl = (MPT_IOCTL *) mem;
|
||||
ioc->ioctl->ioc = ioc;
|
||||
sema_init(&ioc->ioctl->sem_ioc, 1);
|
||||
mutex_init(&ioc->ioctl->ioctl_mutex);
|
||||
return 0;
|
||||
|
||||
out_fail:
|
||||
|
|
|
@ -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)
|
||||
return -ENXIO;
|
||||
|
||||
if (down_interruptible(&ioc->sas_mgmt.mutex))
|
||||
if (mutex_lock_interruptible(&ioc->sas_mgmt.mutex))
|
||||
goto out;
|
||||
|
||||
mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc);
|
||||
|
@ -508,7 +508,7 @@ static int mptsas_phy_reset(struct sas_phy *phy, int hard_reset)
|
|||
error = 0;
|
||||
|
||||
out_unlock:
|
||||
up(&ioc->sas_mgmt.mutex);
|
||||
mutex_unlock(&ioc->sas_mgmt.mutex);
|
||||
out:
|
||||
return error;
|
||||
}
|
||||
|
@ -1477,7 +1477,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||
INIT_LIST_HEAD(&ioc->sas_topology);
|
||||
mutex_init(&ioc->sas_topology_mutex);
|
||||
|
||||
init_MUTEX(&ioc->sas_mgmt.mutex);
|
||||
mutex_init(&ioc->sas_mgmt.mutex);
|
||||
init_completion(&ioc->sas_mgmt.done);
|
||||
|
||||
/* Verify that we won't exceed the maximum
|
||||
|
|
Loading…
Reference in New Issue