aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Dupuis <chad.dupuis@qlogic.com>2010-07-23 06:28:30 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-07-28 10:06:11 -0400
commit8867048b486a64125b62f93af13a379d6d575ee2 (patch)
tree72bd8422dddba119d0b90831cbe8d6441d0b189f
parent14e303d98bcfe4a6075407b531b1df2f237deb28 (diff)
[SCSI] qla2xxx: Add qla2x00_free_fcports() function
This function was added to encapsulate freeing the memory for all the fcports associated with a particular vha. Also added a call to qla2x00_free_fcports() to qla2x00_free_device() to free the memory for all the fcports associated with a vha during device removal. Signed-off-by: Giridhar Malavali <giridhar.malavali@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c7
-rw-r--r--drivers/scsi/qla2xxx/qla_gbl.h1
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c13
3 files changed, 15 insertions, 6 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 7ebf365043cf..93a4c20e2113 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1827,7 +1827,6 @@ static int
1827qla24xx_vport_delete(struct fc_vport *fc_vport) 1827qla24xx_vport_delete(struct fc_vport *fc_vport)
1828{ 1828{
1829 scsi_qla_host_t *vha = fc_vport->dd_data; 1829 scsi_qla_host_t *vha = fc_vport->dd_data;
1830 fc_port_t *fcport, *tfcport;
1831 struct qla_hw_data *ha = vha->hw; 1830 struct qla_hw_data *ha = vha->hw;
1832 uint16_t id = vha->vp_idx; 1831 uint16_t id = vha->vp_idx;
1833 1832
@@ -1841,11 +1840,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
1841 1840
1842 scsi_remove_host(vha->host); 1841 scsi_remove_host(vha->host);
1843 1842
1844 list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) { 1843 qla2x00_free_fcports(vha);
1845 list_del(&fcport->list);
1846 kfree(fcport);
1847 fcport = NULL;
1848 }
1849 1844
1850 qla24xx_deallocate_vp_id(vha); 1845 qla24xx_deallocate_vp_id(vha);
1851 1846
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index 55f4599ade63..84441e8e267e 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -122,6 +122,7 @@ extern struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *,
122extern void qla2x00_free_host(struct scsi_qla_host *); 122extern void qla2x00_free_host(struct scsi_qla_host *);
123extern void qla2x00_relogin(struct scsi_qla_host *); 123extern void qla2x00_relogin(struct scsi_qla_host *);
124extern void qla2x00_do_work(struct scsi_qla_host *); 124extern void qla2x00_do_work(struct scsi_qla_host *);
125extern void qla2x00_free_fcports(struct scsi_qla_host *);
125 126
126/* 127/*
127 * Global Functions in qla_mid.c source file. 128 * Global Functions in qla_mid.c source file.
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 5be8db748964..fcdbf7a0be55 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2487,11 +2487,24 @@ qla2x00_free_device(scsi_qla_host_t *vha)
2487 2487
2488 qla2x00_free_irqs(vha); 2488 qla2x00_free_irqs(vha);
2489 2489
2490 qla2x00_free_fcports(vha);
2491
2490 qla2x00_mem_free(ha); 2492 qla2x00_mem_free(ha);
2491 2493
2492 qla2x00_free_queues(ha); 2494 qla2x00_free_queues(ha);
2493} 2495}
2494 2496
2497void qla2x00_free_fcports(struct scsi_qla_host *vha)
2498{
2499 fc_port_t *fcport, *tfcport;
2500
2501 list_for_each_entry_safe(fcport, tfcport, &vha->vp_fcports, list) {
2502 list_del(&fcport->list);
2503 kfree(fcport);
2504 fcport = NULL;
2505 }
2506}
2507
2495static inline void 2508static inline void
2496qla2x00_schedule_rport_del(struct scsi_qla_host *vha, fc_port_t *fcport, 2509qla2x00_schedule_rport_del(struct scsi_qla_host *vha, fc_port_t *fcport,
2497 int defer) 2510 int defer)