summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorBart Van Assche <bvanassche@acm.org>2011-12-25 19:41:07 +0000
committerRoland Dreier <roland@purestorage.com>2012-11-30 17:40:31 -0800
commitee12d6a80cfcd08b862ed3c8e109442e466b0302 (patch)
treec0a14dc939a2ec87e7b359abc27b15577b600df1 /drivers/infiniband
parent294c875a65269361defd7aeb97804ba99eb57cbf (diff)
downloadop-kernel-dev-ee12d6a80cfcd08b862ed3c8e109442e466b0302.zip
op-kernel-dev-ee12d6a80cfcd08b862ed3c8e109442e466b0302.tar.gz
IB/srp: Introduce the helper function srp_remove_target()
Signed-off-by: Bart Van Assche <bvanassche@acm.org> Acked-by: David Dillow <dillowda@ornl.gov> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 3c64bf4..beb6878 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -506,6 +506,17 @@ static void srp_del_scsi_host_attr(struct Scsi_Host *shost)
device_remove_file(&shost->shost_dev, *attr);
}
+static void srp_remove_target(struct srp_target_port *target)
+{
+ srp_del_scsi_host_attr(target->scsi_host);
+ srp_remove_host(target->scsi_host);
+ scsi_remove_host(target->scsi_host);
+ ib_destroy_cm_id(target->cm_id);
+ srp_free_target_ib(target);
+ srp_free_req_data(target);
+ scsi_host_put(target->scsi_host);
+}
+
static void srp_remove_work(struct work_struct *work)
{
struct srp_target_port *target =
@@ -518,13 +529,7 @@ static void srp_remove_work(struct work_struct *work)
list_del(&target->list);
spin_unlock(&target->srp_host->target_lock);
- srp_del_scsi_host_attr(target->scsi_host);
- srp_remove_host(target->scsi_host);
- scsi_remove_host(target->scsi_host);
- ib_destroy_cm_id(target->cm_id);
- srp_free_target_ib(target);
- srp_free_req_data(target);
- scsi_host_put(target->scsi_host);
+ srp_remove_target(target);
}
static int srp_connect_target(struct srp_target_port *target)
OpenPOWER on IntegriCloud