[openib-general] [PATCH] iw_cxgb3 Change cxio semaphore to mutex.

Steve WIse swise at opengridcomputing.com
Sun Feb 11 13:14:49 PST 2007


From: Steve Wise <swise at opengridcomputing.com>

Change cxio semaphore to mutex.

Signed-off-by: Steve Wise <swise at opengridcomputing.com>
---

 drivers/infiniband/hw/cxgb3/cxio_hal.c |   10 +++++-----
 drivers/infiniband/hw/cxgb3/cxio_hal.h |    4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.c b/drivers/infiniband/hw/cxgb3/cxio_hal.c
index 19553b3..de3cb15 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.c
@@ -30,9 +30,9 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#include <asm/semaphore.h>
 #include <asm/delay.h>
 
+#include <linux/mutex.h>
 #include <linux/netdevice.h>
 #include <linux/sched.h>
 #include <linux/spinlock.h>
@@ -527,7 +527,7 @@ static int cxio_hal_init_ctrl_qp(struct 
 	memset(rdev_p->ctrl_qp.workq, 0,
 	       (1 << T3_CTRL_QP_SIZE_LOG2) * sizeof(union t3_wr));
 
-	init_MUTEX(&rdev_p->ctrl_qp.sem);
+	mutex_init(&rdev_p->ctrl_qp.lock);
 	init_waitqueue_head(&rdev_p->ctrl_qp.waitq);
 
 	/* update HW Ctrl QP context */
@@ -570,7 +570,7 @@ static int cxio_hal_destroy_ctrl_qp(stru
 
 /* write len bytes of data into addr (32B aligned address)
  * If data is NULL, clear len byte of memory to zero.
- * caller aquires the sem before the call
+ * caller aquires the ctrl_qp lock before the call
  */
 static int cxio_hal_ctrl_qp_write_mem(struct cxio_rdev *rdev_p, u32 addr,
 				      u32 len, void *data, int completion)
@@ -705,7 +705,7 @@ static int __cxio_tpt_op(struct cxio_rde
 		}
 	}
 
-	down_interruptible(&rdev_p->ctrl_qp.sem);
+	mutex_lock(&rdev_p->ctrl_qp.lock);
 
 	/* write PBL first if any - update pbl only if pbl list exist */
 	if (pbl) {
@@ -752,7 +752,7 @@ static int __cxio_tpt_op(struct cxio_rde
 		cxio_hal_put_stag(rdev_p->rscp, stag_idx);
 ret:
 	wptr = rdev_p->ctrl_qp.wptr;
-	up(&rdev_p->ctrl_qp.sem);
+	mutex_unlock(&rdev_p->ctrl_qp.lock);
 	if (!err)
 		if (wait_event_interruptible(rdev_p->ctrl_qp.waitq,
 					     SEQ32_GE(rdev_p->ctrl_qp.rptr,
diff --git a/drivers/infiniband/hw/cxgb3/cxio_hal.h b/drivers/infiniband/hw/cxgb3/cxio_hal.h
index 8fb2999..1b97e80 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_hal.h
+++ b/drivers/infiniband/hw/cxgb3/cxio_hal.h
@@ -62,8 +62,8 @@ #define T3_MAX_DEV_NAME_LEN 32
 struct cxio_hal_ctrl_qp {
 	u32 wptr;
 	u32 rptr;
-	struct semaphore sem;	/* for the wtpr, can sleep */
-	wait_queue_head_t waitq;	/* wait for RspQ/CQE msg */
+	struct mutex lock;	/* for the wtpr, can sleep */
+	wait_queue_head_t waitq;/* wait for RspQ/CQE msg */
 	union t3_wr *workq;	/* the work request queue */
 	dma_addr_t dma_addr;	/* pci bus address of the workq */
 	DECLARE_PCI_UNMAP_ADDR(mapping)





More information about the general mailing list