aboutsummaryrefslogtreecommitdiff
path: root/drivers/s390/scsi/zfcp_aux.c
diff options
context:
space:
mode:
authorSwen Schillig <swen@vnet.ibm.com>2009-08-18 15:43:22 +0200
committerJames Bottomley <James.Bottomley@suse.de>2009-09-05 08:49:32 -0500
commitd5a282a1c5084ec7ebd9e6ab9723317f6b3fcd7b (patch)
treea215cde519ca65b129d35d8d435061b48ab3864c /drivers/s390/scsi/zfcp_aux.c
parent5771710bd5edfafcb8656f49b93690a6fae5a4d2 (diff)
[SCSI] zfcp: introduce _setup, _destroy for qdio and FC
Extract independent data structures and introduce common _setup and _destroy routines for QDIO and Fibre Channel related data structures Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/s390/scsi/zfcp_aux.c')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 7a50f64c36b..c77686ed938 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -506,30 +506,18 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
if (!adapter)
return -ENOMEM;
- adapter->gs = kzalloc(sizeof(struct zfcp_wka_ports), GFP_KERNEL);
- if (!adapter->gs) {
- kfree(adapter);
- return -ENOMEM;
- }
-
- adapter->qdio = kzalloc(sizeof(struct zfcp_qdio), GFP_KERNEL);
- if (!adapter->qdio)
- goto qdio_mem_failed;
-
- adapter->qdio->adapter = adapter;
-
ccw_device->handler = NULL;
adapter->ccw_device = ccw_device;
atomic_set(&adapter->refcount, 0);
- if (zfcp_qdio_allocate(adapter->qdio, ccw_device))
- goto qdio_allocate_failed;
+ if (zfcp_qdio_setup(adapter))
+ goto qdio_failed;
if (zfcp_allocate_low_mem_buffers(adapter))
- goto failed_low_mem_buffers;
+ goto low_mem_buffers_failed;
if (zfcp_reqlist_alloc(adapter))
- goto failed_low_mem_buffers;
+ goto low_mem_buffers_failed;
if (zfcp_dbf_adapter_register(adapter))
goto debug_register_failed;
@@ -537,6 +525,9 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
if (zfcp_setup_adapter_work_queue(adapter))
goto work_queue_failed;
+ if (zfcp_fc_gs_setup(adapter))
+ goto generic_services_failed;
+
init_waitqueue_head(&adapter->remove_wq);
init_waitqueue_head(&adapter->erp_thread_wqh);
init_waitqueue_head(&adapter->erp_done_wqh);
@@ -547,9 +538,6 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
spin_lock_init(&adapter->req_list_lock);
- spin_lock_init(&adapter->qdio->req_q_lock);
- spin_lock_init(&adapter->qdio->stat_lock);
-
rwlock_init(&adapter->erp_lock);
rwlock_init(&adapter->abort_lock);
@@ -570,24 +558,23 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
goto sysfs_failed;
atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status);
- zfcp_fc_wka_ports_init(adapter);
if (!zfcp_adapter_scsi_register(adapter))
return 0;
sysfs_failed:
+ zfcp_fc_gs_destroy(adapter);
+generic_services_failed:
zfcp_destroy_adapter_work_queue(adapter);
work_queue_failed:
zfcp_dbf_adapter_unregister(adapter->dbf);
debug_register_failed:
dev_set_drvdata(&ccw_device->dev, NULL);
kfree(adapter->req_list);
-failed_low_mem_buffers:
+low_mem_buffers_failed:
zfcp_free_low_mem_buffers(adapter);
-qdio_allocate_failed:
- zfcp_qdio_free(adapter->qdio);
- kfree(adapter->qdio);
-qdio_mem_failed:
+qdio_failed:
+ zfcp_qdio_destroy(adapter->qdio);
kfree(adapter);
return -ENOMEM;
}
@@ -616,15 +603,14 @@ void zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
if (!retval)
return;
+ zfcp_fc_gs_destroy(adapter);
zfcp_destroy_adapter_work_queue(adapter);
zfcp_dbf_adapter_unregister(adapter->dbf);
- zfcp_qdio_free(adapter->qdio);
zfcp_free_low_mem_buffers(adapter);
+ zfcp_qdio_destroy(adapter->qdio);
kfree(adapter->req_list);
kfree(adapter->fc_stats);
kfree(adapter->stats_reset_data);
- kfree(adapter->gs);
- kfree(adapter->qdio);
kfree(adapter);
}