diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 00:37:33 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 00:37:33 -0500 |
commit | a6df590dd8b7644c8e298e3b13442bcd6ceeb739 (patch) | |
tree | 2f4e92634d518a4d26614a113ce724dc97ccd898 /drivers | |
parent | 2f4c5416b36a5601d57f09e87a514a171390d5e0 (diff) | |
parent | fd9cfdd11be3b37b5c919b64b43990f14a1587bd (diff) |
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_cmd.c | 13 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_dev.h | 8 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_main.c | 10 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_mcg.c | 20 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_memfree.c | 36 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_memfree.h | 7 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_provider.c | 6 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 14 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.h | 5 |
9 files changed, 58 insertions, 61 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c index be1791be627b..f9b9b93dc501 100644 --- a/drivers/infiniband/hw/mthca/mthca_cmd.c +++ b/drivers/infiniband/hw/mthca/mthca_cmd.c | |||
@@ -199,8 +199,7 @@ static int mthca_cmd_post(struct mthca_dev *dev, | |||
199 | { | 199 | { |
200 | int err = 0; | 200 | int err = 0; |
201 | 201 | ||
202 | if (down_interruptible(&dev->cmd.hcr_sem)) | 202 | mutex_lock(&dev->cmd.hcr_mutex); |
203 | return -EINTR; | ||
204 | 203 | ||
205 | if (event) { | 204 | if (event) { |
206 | unsigned long end = jiffies + GO_BIT_TIMEOUT; | 205 | unsigned long end = jiffies + GO_BIT_TIMEOUT; |
@@ -238,7 +237,7 @@ static int mthca_cmd_post(struct mthca_dev *dev, | |||
238 | op), dev->hcr + 6 * 4); | 237 | op), dev->hcr + 6 * 4); |
239 | 238 | ||
240 | out: | 239 | out: |
241 | up(&dev->cmd.hcr_sem); | 240 | mutex_unlock(&dev->cmd.hcr_mutex); |
242 | return err; | 241 | return err; |
243 | } | 242 | } |
244 | 243 | ||
@@ -255,8 +254,7 @@ static int mthca_cmd_poll(struct mthca_dev *dev, | |||
255 | int err = 0; | 254 | int err = 0; |
256 | unsigned long end; | 255 | unsigned long end; |
257 | 256 | ||
258 | if (down_interruptible(&dev->cmd.poll_sem)) | 257 | down(&dev->cmd.poll_sem); |
259 | return -EINTR; | ||
260 | 258 | ||
261 | err = mthca_cmd_post(dev, in_param, | 259 | err = mthca_cmd_post(dev, in_param, |
262 | out_param ? *out_param : 0, | 260 | out_param ? *out_param : 0, |
@@ -333,8 +331,7 @@ static int mthca_cmd_wait(struct mthca_dev *dev, | |||
333 | int err = 0; | 331 | int err = 0; |
334 | struct mthca_cmd_context *context; | 332 | struct mthca_cmd_context *context; |
335 | 333 | ||
336 | if (down_interruptible(&dev->cmd.event_sem)) | 334 | down(&dev->cmd.event_sem); |
337 | return -EINTR; | ||
338 | 335 | ||
339 | spin_lock(&dev->cmd.context_lock); | 336 | spin_lock(&dev->cmd.context_lock); |
340 | BUG_ON(dev->cmd.free_head < 0); | 337 | BUG_ON(dev->cmd.free_head < 0); |
@@ -438,7 +435,7 @@ static int mthca_cmd_imm(struct mthca_dev *dev, | |||
438 | 435 | ||
439 | int mthca_cmd_init(struct mthca_dev *dev) | 436 | int mthca_cmd_init(struct mthca_dev *dev) |
440 | { | 437 | { |
441 | sema_init(&dev->cmd.hcr_sem, 1); | 438 | mutex_init(&dev->cmd.hcr_mutex); |
442 | sema_init(&dev->cmd.poll_sem, 1); | 439 | sema_init(&dev->cmd.poll_sem, 1); |
443 | dev->cmd.use_events = 0; | 440 | dev->cmd.use_events = 0; |
444 | 441 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h index a104ab041ea3..2a165fd06e57 100644 --- a/drivers/infiniband/hw/mthca/mthca_dev.h +++ b/drivers/infiniband/hw/mthca/mthca_dev.h | |||
@@ -44,6 +44,8 @@ | |||
44 | #include <linux/pci.h> | 44 | #include <linux/pci.h> |
45 | #include <linux/dma-mapping.h> | 45 | #include <linux/dma-mapping.h> |
46 | #include <linux/timer.h> | 46 | #include <linux/timer.h> |
47 | #include <linux/mutex.h> | ||
48 | |||
47 | #include <asm/semaphore.h> | 49 | #include <asm/semaphore.h> |
48 | 50 | ||
49 | #include "mthca_provider.h" | 51 | #include "mthca_provider.h" |
@@ -111,7 +113,7 @@ enum { | |||
111 | struct mthca_cmd { | 113 | struct mthca_cmd { |
112 | struct pci_pool *pool; | 114 | struct pci_pool *pool; |
113 | int use_events; | 115 | int use_events; |
114 | struct semaphore hcr_sem; | 116 | struct mutex hcr_mutex; |
115 | struct semaphore poll_sem; | 117 | struct semaphore poll_sem; |
116 | struct semaphore event_sem; | 118 | struct semaphore event_sem; |
117 | int max_cmds; | 119 | int max_cmds; |
@@ -256,7 +258,7 @@ struct mthca_av_table { | |||
256 | }; | 258 | }; |
257 | 259 | ||
258 | struct mthca_mcg_table { | 260 | struct mthca_mcg_table { |
259 | struct semaphore sem; | 261 | struct mutex mutex; |
260 | struct mthca_alloc alloc; | 262 | struct mthca_alloc alloc; |
261 | struct mthca_icm_table *table; | 263 | struct mthca_icm_table *table; |
262 | }; | 264 | }; |
@@ -301,7 +303,7 @@ struct mthca_dev { | |||
301 | u64 ddr_end; | 303 | u64 ddr_end; |
302 | 304 | ||
303 | MTHCA_DECLARE_DOORBELL_LOCK(doorbell_lock) | 305 | MTHCA_DECLARE_DOORBELL_LOCK(doorbell_lock) |
304 | struct semaphore cap_mask_mutex; | 306 | struct mutex cap_mask_mutex; |
305 | 307 | ||
306 | void __iomem *hcr; | 308 | void __iomem *hcr; |
307 | void __iomem *kar; | 309 | void __iomem *kar; |
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index 8b00d9a0f6f4..9c849d27b06e 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c | |||
@@ -155,6 +155,13 @@ static int __devinit mthca_dev_lim(struct mthca_dev *mdev, struct mthca_dev_lim | |||
155 | return -ENODEV; | 155 | return -ENODEV; |
156 | } | 156 | } |
157 | 157 | ||
158 | if (dev_lim->uar_size > pci_resource_len(mdev->pdev, 2)) { | ||
159 | mthca_err(mdev, "HCA reported UAR size of 0x%x bigger than " | ||
160 | "PCI resource 2 size of 0x%lx, aborting.\n", | ||
161 | dev_lim->uar_size, pci_resource_len(mdev->pdev, 2)); | ||
162 | return -ENODEV; | ||
163 | } | ||
164 | |||
158 | mdev->limits.num_ports = dev_lim->num_ports; | 165 | mdev->limits.num_ports = dev_lim->num_ports; |
159 | mdev->limits.vl_cap = dev_lim->max_vl; | 166 | mdev->limits.vl_cap = dev_lim->max_vl; |
160 | mdev->limits.mtu_cap = dev_lim->max_mtu; | 167 | mdev->limits.mtu_cap = dev_lim->max_mtu; |
@@ -976,8 +983,7 @@ static int __devinit mthca_init_one(struct pci_dev *pdev, | |||
976 | err = -ENODEV; | 983 | err = -ENODEV; |
977 | goto err_disable_pdev; | 984 | goto err_disable_pdev; |
978 | } | 985 | } |
979 | if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM) || | 986 | if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { |
980 | pci_resource_len(pdev, 2) != 1 << 23) { | ||
981 | dev_err(&pdev->dev, "Missing UAR, aborting.\n"); | 987 | dev_err(&pdev->dev, "Missing UAR, aborting.\n"); |
982 | err = -ENODEV; | 988 | err = -ENODEV; |
983 | goto err_disable_pdev; | 989 | goto err_disable_pdev; |
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 | } |
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c index 9fb985a016e9..d709cb162a72 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c | |||
@@ -50,7 +50,7 @@ enum { | |||
50 | }; | 50 | }; |
51 | 51 | ||
52 | struct mthca_user_db_table { | 52 | struct mthca_user_db_table { |
53 | struct semaphore mutex; | 53 | struct mutex mutex; |
54 | struct { | 54 | struct { |
55 | u64 uvirt; | 55 | u64 uvirt; |
56 | struct scatterlist mem; | 56 | struct scatterlist mem; |
@@ -158,7 +158,7 @@ int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int ob | |||
158 | int ret = 0; | 158 | int ret = 0; |
159 | u8 status; | 159 | u8 status; |
160 | 160 | ||
161 | down(&table->mutex); | 161 | mutex_lock(&table->mutex); |
162 | 162 | ||
163 | if (table->icm[i]) { | 163 | if (table->icm[i]) { |
164 | ++table->icm[i]->refcount; | 164 | ++table->icm[i]->refcount; |
@@ -184,7 +184,7 @@ int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int ob | |||
184 | ++table->icm[i]->refcount; | 184 | ++table->icm[i]->refcount; |
185 | 185 | ||
186 | out: | 186 | out: |
187 | up(&table->mutex); | 187 | mutex_unlock(&table->mutex); |
188 | return ret; | 188 | return ret; |
189 | } | 189 | } |
190 | 190 | ||
@@ -198,7 +198,7 @@ void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int o | |||
198 | 198 | ||
199 | i = (obj & (table->num_obj - 1)) * table->obj_size / MTHCA_TABLE_CHUNK_SIZE; | 199 | i = (obj & (table->num_obj - 1)) * table->obj_size / MTHCA_TABLE_CHUNK_SIZE; |
200 | 200 | ||
201 | down(&table->mutex); | 201 | mutex_lock(&table->mutex); |
202 | 202 | ||
203 | if (--table->icm[i]->refcount == 0) { | 203 | if (--table->icm[i]->refcount == 0) { |
204 | mthca_UNMAP_ICM(dev, table->virt + i * MTHCA_TABLE_CHUNK_SIZE, | 204 | mthca_UNMAP_ICM(dev, table->virt + i * MTHCA_TABLE_CHUNK_SIZE, |
@@ -207,7 +207,7 @@ void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int o | |||
207 | table->icm[i] = NULL; | 207 | table->icm[i] = NULL; |
208 | } | 208 | } |
209 | 209 | ||
210 | up(&table->mutex); | 210 | mutex_unlock(&table->mutex); |
211 | } | 211 | } |
212 | 212 | ||
213 | void *mthca_table_find(struct mthca_icm_table *table, int obj) | 213 | void *mthca_table_find(struct mthca_icm_table *table, int obj) |
@@ -220,7 +220,7 @@ void *mthca_table_find(struct mthca_icm_table *table, int obj) | |||
220 | if (!table->lowmem) | 220 | if (!table->lowmem) |
221 | return NULL; | 221 | return NULL; |
222 | 222 | ||
223 | down(&table->mutex); | 223 | mutex_lock(&table->mutex); |
224 | 224 | ||
225 | idx = (obj & (table->num_obj - 1)) * table->obj_size; | 225 | idx = (obj & (table->num_obj - 1)) * table->obj_size; |
226 | icm = table->icm[idx / MTHCA_TABLE_CHUNK_SIZE]; | 226 | icm = table->icm[idx / MTHCA_TABLE_CHUNK_SIZE]; |
@@ -240,7 +240,7 @@ void *mthca_table_find(struct mthca_icm_table *table, int obj) | |||
240 | } | 240 | } |
241 | 241 | ||
242 | out: | 242 | out: |
243 | up(&table->mutex); | 243 | mutex_unlock(&table->mutex); |
244 | return page ? lowmem_page_address(page) + offset : NULL; | 244 | return page ? lowmem_page_address(page) + offset : NULL; |
245 | } | 245 | } |
246 | 246 | ||
@@ -301,7 +301,7 @@ struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev, | |||
301 | table->num_obj = nobj; | 301 | table->num_obj = nobj; |
302 | table->obj_size = obj_size; | 302 | table->obj_size = obj_size; |
303 | table->lowmem = use_lowmem; | 303 | table->lowmem = use_lowmem; |
304 | init_MUTEX(&table->mutex); | 304 | mutex_init(&table->mutex); |
305 | 305 | ||
306 | for (i = 0; i < num_icm; ++i) | 306 | for (i = 0; i < num_icm; ++i) |
307 | table->icm[i] = NULL; | 307 | table->icm[i] = NULL; |
@@ -380,7 +380,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar, | |||
380 | if (index < 0 || index > dev->uar_table.uarc_size / 8) | 380 | if (index < 0 || index > dev->uar_table.uarc_size / 8) |
381 | return -EINVAL; | 381 | return -EINVAL; |
382 | 382 | ||
383 | down(&db_tab->mutex); | 383 | mutex_lock(&db_tab->mutex); |
384 | 384 | ||
385 | i = index / MTHCA_DB_REC_PER_PAGE; | 385 | i = index / MTHCA_DB_REC_PER_PAGE; |
386 | 386 | ||
@@ -424,7 +424,7 @@ int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar, | |||
424 | db_tab->page[i].refcount = 1; | 424 | db_tab->page[i].refcount = 1; |
425 | 425 | ||
426 | out: | 426 | out: |
427 | up(&db_tab->mutex); | 427 | mutex_unlock(&db_tab->mutex); |
428 | return ret; | 428 | return ret; |
429 | } | 429 | } |
430 | 430 | ||
@@ -439,11 +439,11 @@ void mthca_unmap_user_db(struct mthca_dev *dev, struct mthca_uar *uar, | |||
439 | * pages until we clean up the whole db table. | 439 | * pages until we clean up the whole db table. |
440 | */ | 440 | */ |
441 | 441 | ||
442 | down(&db_tab->mutex); | 442 | mutex_lock(&db_tab->mutex); |
443 | 443 | ||
444 | --db_tab->page[index / MTHCA_DB_REC_PER_PAGE].refcount; | 444 | --db_tab->page[index / MTHCA_DB_REC_PER_PAGE].refcount; |
445 | 445 | ||
446 | up(&db_tab->mutex); | 446 | mutex_unlock(&db_tab->mutex); |
447 | } | 447 | } |
448 | 448 | ||
449 | struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev) | 449 | struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev) |
@@ -460,7 +460,7 @@ struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev) | |||
460 | if (!db_tab) | 460 | if (!db_tab) |
461 | return ERR_PTR(-ENOMEM); | 461 | return ERR_PTR(-ENOMEM); |
462 | 462 | ||
463 | init_MUTEX(&db_tab->mutex); | 463 | mutex_init(&db_tab->mutex); |
464 | for (i = 0; i < npages; ++i) { | 464 | for (i = 0; i < npages; ++i) { |
465 | db_tab->page[i].refcount = 0; | 465 | db_tab->page[i].refcount = 0; |
466 | db_tab->page[i].uvirt = 0; | 466 | db_tab->page[i].uvirt = 0; |
@@ -499,7 +499,7 @@ int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type, | |||
499 | int ret = 0; | 499 | int ret = 0; |
500 | u8 status; | 500 | u8 status; |
501 | 501 | ||
502 | down(&dev->db_tab->mutex); | 502 | mutex_lock(&dev->db_tab->mutex); |
503 | 503 | ||
504 | switch (type) { | 504 | switch (type) { |
505 | case MTHCA_DB_TYPE_CQ_ARM: | 505 | case MTHCA_DB_TYPE_CQ_ARM: |
@@ -585,7 +585,7 @@ found: | |||
585 | *db = (__be32 *) &page->db_rec[j]; | 585 | *db = (__be32 *) &page->db_rec[j]; |
586 | 586 | ||
587 | out: | 587 | out: |
588 | up(&dev->db_tab->mutex); | 588 | mutex_unlock(&dev->db_tab->mutex); |
589 | 589 | ||
590 | return ret; | 590 | return ret; |
591 | } | 591 | } |
@@ -601,7 +601,7 @@ void mthca_free_db(struct mthca_dev *dev, int type, int db_index) | |||
601 | 601 | ||
602 | page = dev->db_tab->page + i; | 602 | page = dev->db_tab->page + i; |
603 | 603 | ||
604 | down(&dev->db_tab->mutex); | 604 | mutex_lock(&dev->db_tab->mutex); |
605 | 605 | ||
606 | page->db_rec[j] = 0; | 606 | page->db_rec[j] = 0; |
607 | if (i >= dev->db_tab->min_group2) | 607 | if (i >= dev->db_tab->min_group2) |
@@ -624,7 +624,7 @@ void mthca_free_db(struct mthca_dev *dev, int type, int db_index) | |||
624 | ++dev->db_tab->min_group2; | 624 | ++dev->db_tab->min_group2; |
625 | } | 625 | } |
626 | 626 | ||
627 | up(&dev->db_tab->mutex); | 627 | mutex_unlock(&dev->db_tab->mutex); |
628 | } | 628 | } |
629 | 629 | ||
630 | int mthca_init_db_tab(struct mthca_dev *dev) | 630 | int mthca_init_db_tab(struct mthca_dev *dev) |
@@ -638,7 +638,7 @@ int mthca_init_db_tab(struct mthca_dev *dev) | |||
638 | if (!dev->db_tab) | 638 | if (!dev->db_tab) |
639 | return -ENOMEM; | 639 | return -ENOMEM; |
640 | 640 | ||
641 | init_MUTEX(&dev->db_tab->mutex); | 641 | mutex_init(&dev->db_tab->mutex); |
642 | 642 | ||
643 | dev->db_tab->npages = dev->uar_table.uarc_size / 4096; | 643 | dev->db_tab->npages = dev->uar_table.uarc_size / 4096; |
644 | dev->db_tab->max_group1 = 0; | 644 | dev->db_tab->max_group1 = 0; |
diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.h b/drivers/infiniband/hw/mthca/mthca_memfree.h index 4fdca26eea85..36f1141a08aa 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.h +++ b/drivers/infiniband/hw/mthca/mthca_memfree.h | |||
@@ -39,8 +39,7 @@ | |||
39 | 39 | ||
40 | #include <linux/list.h> | 40 | #include <linux/list.h> |
41 | #include <linux/pci.h> | 41 | #include <linux/pci.h> |
42 | 42 | #include <linux/mutex.h> | |
43 | #include <asm/semaphore.h> | ||
44 | 43 | ||
45 | #define MTHCA_ICM_CHUNK_LEN \ | 44 | #define MTHCA_ICM_CHUNK_LEN \ |
46 | ((256 - sizeof (struct list_head) - 2 * sizeof (int)) / \ | 45 | ((256 - sizeof (struct list_head) - 2 * sizeof (int)) / \ |
@@ -64,7 +63,7 @@ struct mthca_icm_table { | |||
64 | int num_obj; | 63 | int num_obj; |
65 | int obj_size; | 64 | int obj_size; |
66 | int lowmem; | 65 | int lowmem; |
67 | struct semaphore mutex; | 66 | struct mutex mutex; |
68 | struct mthca_icm *icm[0]; | 67 | struct mthca_icm *icm[0]; |
69 | }; | 68 | }; |
70 | 69 | ||
@@ -147,7 +146,7 @@ struct mthca_db_table { | |||
147 | int max_group1; | 146 | int max_group1; |
148 | int min_group2; | 147 | int min_group2; |
149 | struct mthca_db_page *page; | 148 | struct mthca_db_page *page; |
150 | struct semaphore mutex; | 149 | struct mutex mutex; |
151 | }; | 150 | }; |
152 | 151 | ||
153 | enum mthca_db_type { | 152 | enum mthca_db_type { |
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c index 484a7e6b7f8c..e88e39aef85a 100644 --- a/drivers/infiniband/hw/mthca/mthca_provider.c +++ b/drivers/infiniband/hw/mthca/mthca_provider.c | |||
@@ -185,7 +185,7 @@ static int mthca_modify_port(struct ib_device *ibdev, | |||
185 | int err; | 185 | int err; |
186 | u8 status; | 186 | u8 status; |
187 | 187 | ||
188 | if (down_interruptible(&to_mdev(ibdev)->cap_mask_mutex)) | 188 | if (mutex_lock_interruptible(&to_mdev(ibdev)->cap_mask_mutex)) |
189 | return -ERESTARTSYS; | 189 | return -ERESTARTSYS; |
190 | 190 | ||
191 | err = mthca_query_port(ibdev, port, &attr); | 191 | err = mthca_query_port(ibdev, port, &attr); |
@@ -207,7 +207,7 @@ static int mthca_modify_port(struct ib_device *ibdev, | |||
207 | } | 207 | } |
208 | 208 | ||
209 | out: | 209 | out: |
210 | up(&to_mdev(ibdev)->cap_mask_mutex); | 210 | mutex_unlock(&to_mdev(ibdev)->cap_mask_mutex); |
211 | return err; | 211 | return err; |
212 | } | 212 | } |
213 | 213 | ||
@@ -1185,7 +1185,7 @@ int mthca_register_device(struct mthca_dev *dev) | |||
1185 | dev->ib_dev.post_recv = mthca_tavor_post_receive; | 1185 | dev->ib_dev.post_recv = mthca_tavor_post_receive; |
1186 | } | 1186 | } |
1187 | 1187 | ||
1188 | init_MUTEX(&dev->cap_mask_mutex); | 1188 | mutex_init(&dev->cap_mask_mutex); |
1189 | 1189 | ||
1190 | ret = ib_register_device(&dev->ib_dev); | 1190 | ret = ib_register_device(&dev->ib_dev); |
1191 | if (ret) | 1191 | if (ret) |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 31207e664148..2d2d4ac3525a 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -357,9 +357,9 @@ static void srp_remove_work(void *target_ptr) | |||
357 | target->state = SRP_TARGET_REMOVED; | 357 | target->state = SRP_TARGET_REMOVED; |
358 | spin_unlock_irq(target->scsi_host->host_lock); | 358 | spin_unlock_irq(target->scsi_host->host_lock); |
359 | 359 | ||
360 | down(&target->srp_host->target_mutex); | 360 | mutex_lock(&target->srp_host->target_mutex); |
361 | list_del(&target->list); | 361 | list_del(&target->list); |
362 | up(&target->srp_host->target_mutex); | 362 | mutex_unlock(&target->srp_host->target_mutex); |
363 | 363 | ||
364 | scsi_remove_host(target->scsi_host); | 364 | scsi_remove_host(target->scsi_host); |
365 | ib_destroy_cm_id(target->cm_id); | 365 | ib_destroy_cm_id(target->cm_id); |
@@ -1254,9 +1254,9 @@ static int srp_add_target(struct srp_host *host, struct srp_target_port *target) | |||
1254 | if (scsi_add_host(target->scsi_host, host->dev->dma_device)) | 1254 | if (scsi_add_host(target->scsi_host, host->dev->dma_device)) |
1255 | return -ENODEV; | 1255 | return -ENODEV; |
1256 | 1256 | ||
1257 | down(&host->target_mutex); | 1257 | mutex_lock(&host->target_mutex); |
1258 | list_add_tail(&target->list, &host->target_list); | 1258 | list_add_tail(&target->list, &host->target_list); |
1259 | up(&host->target_mutex); | 1259 | mutex_unlock(&host->target_mutex); |
1260 | 1260 | ||
1261 | target->state = SRP_TARGET_LIVE; | 1261 | target->state = SRP_TARGET_LIVE; |
1262 | 1262 | ||
@@ -1525,7 +1525,7 @@ static struct srp_host *srp_add_port(struct ib_device *device, u8 port) | |||
1525 | return NULL; | 1525 | return NULL; |
1526 | 1526 | ||
1527 | INIT_LIST_HEAD(&host->target_list); | 1527 | INIT_LIST_HEAD(&host->target_list); |
1528 | init_MUTEX(&host->target_mutex); | 1528 | mutex_init(&host->target_mutex); |
1529 | init_completion(&host->released); | 1529 | init_completion(&host->released); |
1530 | host->dev = device; | 1530 | host->dev = device; |
1531 | host->port = port; | 1531 | host->port = port; |
@@ -1626,7 +1626,7 @@ static void srp_remove_one(struct ib_device *device) | |||
1626 | * Mark all target ports as removed, so we stop queueing | 1626 | * Mark all target ports as removed, so we stop queueing |
1627 | * commands and don't try to reconnect. | 1627 | * commands and don't try to reconnect. |
1628 | */ | 1628 | */ |
1629 | down(&host->target_mutex); | 1629 | mutex_lock(&host->target_mutex); |
1630 | list_for_each_entry_safe(target, tmp_target, | 1630 | list_for_each_entry_safe(target, tmp_target, |
1631 | &host->target_list, list) { | 1631 | &host->target_list, list) { |
1632 | spin_lock_irqsave(target->scsi_host->host_lock, flags); | 1632 | spin_lock_irqsave(target->scsi_host->host_lock, flags); |
@@ -1634,7 +1634,7 @@ static void srp_remove_one(struct ib_device *device) | |||
1634 | target->state = SRP_TARGET_REMOVED; | 1634 | target->state = SRP_TARGET_REMOVED; |
1635 | spin_unlock_irqrestore(target->scsi_host->host_lock, flags); | 1635 | spin_unlock_irqrestore(target->scsi_host->host_lock, flags); |
1636 | } | 1636 | } |
1637 | up(&host->target_mutex); | 1637 | mutex_unlock(&host->target_mutex); |
1638 | 1638 | ||
1639 | /* | 1639 | /* |
1640 | * Wait for any reconnection tasks that may have | 1640 | * Wait for any reconnection tasks that may have |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h index b564f18caf78..4e7727df32f1 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.h +++ b/drivers/infiniband/ulp/srp/ib_srp.h | |||
@@ -37,8 +37,7 @@ | |||
37 | 37 | ||
38 | #include <linux/types.h> | 38 | #include <linux/types.h> |
39 | #include <linux/list.h> | 39 | #include <linux/list.h> |
40 | 40 | #include <linux/mutex.h> | |
41 | #include <asm/semaphore.h> | ||
42 | 41 | ||
43 | #include <scsi/scsi_host.h> | 42 | #include <scsi/scsi_host.h> |
44 | #include <scsi/scsi_cmnd.h> | 43 | #include <scsi/scsi_cmnd.h> |
@@ -85,7 +84,7 @@ struct srp_host { | |||
85 | struct ib_mr *mr; | 84 | struct ib_mr *mr; |
86 | struct class_device class_dev; | 85 | struct class_device class_dev; |
87 | struct list_head target_list; | 86 | struct list_head target_list; |
88 | struct semaphore target_mutex; | 87 | struct mutex target_mutex; |
89 | struct completion released; | 88 | struct completion released; |
90 | struct list_head list; | 89 | struct list_head list; |
91 | }; | 90 | }; |