diff options
author | Bart Van Assche <bvanassche@acm.org> | 2011-12-25 14:41:07 -0500 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2012-11-30 20:40:31 -0500 |
commit | ee12d6a80cfcd08b862ed3c8e109442e466b0302 (patch) | |
tree | c0a14dc939a2ec87e7b359abc27b15577b600df1 /drivers/infiniband/ulp | |
parent | 294c875a65269361defd7aeb97804ba99eb57cbf (diff) |
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/ulp')
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 19 |
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 3c64bf400c20..beb68786001e 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) | |||
506 | device_remove_file(&shost->shost_dev, *attr); | 506 | device_remove_file(&shost->shost_dev, *attr); |
507 | } | 507 | } |
508 | 508 | ||
509 | static void srp_remove_target(struct srp_target_port *target) | ||
510 | { | ||
511 | srp_del_scsi_host_attr(target->scsi_host); | ||
512 | srp_remove_host(target->scsi_host); | ||
513 | scsi_remove_host(target->scsi_host); | ||
514 | ib_destroy_cm_id(target->cm_id); | ||
515 | srp_free_target_ib(target); | ||
516 | srp_free_req_data(target); | ||
517 | scsi_host_put(target->scsi_host); | ||
518 | } | ||
519 | |||
509 | static void srp_remove_work(struct work_struct *work) | 520 | static void srp_remove_work(struct work_struct *work) |
510 | { | 521 | { |
511 | struct srp_target_port *target = | 522 | struct srp_target_port *target = |
@@ -518,13 +529,7 @@ static void srp_remove_work(struct work_struct *work) | |||
518 | list_del(&target->list); | 529 | list_del(&target->list); |
519 | spin_unlock(&target->srp_host->target_lock); | 530 | spin_unlock(&target->srp_host->target_lock); |
520 | 531 | ||
521 | srp_del_scsi_host_attr(target->scsi_host); | 532 | srp_remove_target(target); |
522 | srp_remove_host(target->scsi_host); | ||
523 | scsi_remove_host(target->scsi_host); | ||
524 | ib_destroy_cm_id(target->cm_id); | ||
525 | srp_free_target_ib(target); | ||
526 | srp_free_req_data(target); | ||
527 | scsi_host_put(target->scsi_host); | ||
528 | } | 533 | } |
529 | 534 | ||
530 | static int srp_connect_target(struct srp_target_port *target) | 535 | static int srp_connect_target(struct srp_target_port *target) |