From: Christoph Hellwig Date: Fri, 13 Jan 2006 17:27:11 +0000 (+0100) Subject: [SCSI] fusion: convert semaphores to mutexes X-Git-Tag: MMI-PSA29.97-13-9~52891^2~35 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=eeb846cefdd842af479393a7d0fd399a29e42532;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [SCSI] fusion: convert semaphores to mutexes Signed-off-by: Christoph Hellwig Signed-off-by: James Bottomley --- 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 { 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 */ 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) 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: 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) 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