aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2006-01-30 18:21:21 -0500
committerRoland Dreier <rolandd@cisco.com>2006-01-30 18:21:21 -0500
commit8e9e5f4f5eb1d44ddabfd1ddea4ca4e4244a9ffb (patch)
treeb2f64b85be17ddb169355defe05f9dbf5c97d548 /drivers/infiniband/ulp
parentcbd2981a97cb628431a987a8abd1731c74bcc32e (diff)
IB/srp: Semaphore to mutex conversion
Convert srp_host->target_mutex from a semaphore to a mutex. Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/ulp')
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c14
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.h5
2 files changed, 9 insertions, 10 deletions
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};