aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_mcg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_mcg.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mcg.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_mcg.c b/drivers/infiniband/hw/mthca/mthca_mcg.c
index 77bc6c746f43..321f11e707f2 100644
--- a/drivers/infiniband/hw/mthca/mthca_mcg.c
+++ b/drivers/infiniband/hw/mthca/mthca_mcg.c
@@ -154,10 +154,7 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
154 return PTR_ERR(mailbox); 154 return PTR_ERR(mailbox);
155 mgm = mailbox->buf; 155 mgm = mailbox->buf;
156 156
157 if (down_interruptible(&dev->mcg_table.sem)) { 157 mutex_lock(&dev->mcg_table.mutex);
158 err = -EINTR;
159 goto err_sem;
160 }
161 158
162 err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index); 159 err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index);
163 if (err) 160 if (err)
@@ -241,8 +238,8 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
241 BUG_ON(index < dev->limits.num_mgms); 238 BUG_ON(index < dev->limits.num_mgms);
242 mthca_free(&dev->mcg_table.alloc, index); 239 mthca_free(&dev->mcg_table.alloc, index);
243 } 240 }
244 up(&dev->mcg_table.sem); 241 mutex_unlock(&dev->mcg_table.mutex);
245 err_sem: 242
246 mthca_free_mailbox(dev, mailbox); 243 mthca_free_mailbox(dev, mailbox);
247 return err; 244 return err;
248} 245}
@@ -263,10 +260,7 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
263 return PTR_ERR(mailbox); 260 return PTR_ERR(mailbox);
264 mgm = mailbox->buf; 261 mgm = mailbox->buf;
265 262
266 if (down_interruptible(&dev->mcg_table.sem)) { 263 mutex_lock(&dev->mcg_table.mutex);
267 err = -EINTR;
268 goto err_sem;
269 }
270 264
271 err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index); 265 err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index);
272 if (err) 266 if (err)
@@ -371,8 +365,8 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
371 } 365 }
372 366
373 out: 367 out:
374 up(&dev->mcg_table.sem); 368 mutex_unlock(&dev->mcg_table.mutex);
375 err_sem: 369
376 mthca_free_mailbox(dev, mailbox); 370 mthca_free_mailbox(dev, mailbox);
377 return err; 371 return err;
378} 372}
@@ -389,7 +383,7 @@ int __devinit mthca_init_mcg_table(struct mthca_dev *dev)
389 if (err) 383 if (err)
390 return err; 384 return err;
391 385
392 init_MUTEX(&dev->mcg_table.sem); 386 mutex_init(&dev->mcg_table.mutex);
393 387
394 return 0; 388 return 0;
395} 389}