diff options
author | Swen Schillig <swen@vnet.ibm.com> | 2009-08-18 09:43:22 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-09-05 09:49:32 -0400 |
commit | d5a282a1c5084ec7ebd9e6ab9723317f6b3fcd7b (patch) | |
tree | a215cde519ca65b129d35d8d435061b48ab3864c /drivers/s390/scsi/zfcp_aux.c | |
parent | 5771710bd5edfafcb8656f49b93690a6fae5a4d2 (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.c | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 7a50f64c36bd..c77686ed938c 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) | |||
506 | if (!adapter) | 506 | if (!adapter) |
507 | return -ENOMEM; | 507 | return -ENOMEM; |
508 | 508 | ||
509 | adapter->gs = kzalloc(sizeof(struct zfcp_wka_ports), GFP_KERNEL); | ||
510 | if (!adapter->gs) { | ||
511 | kfree(adapter); | ||
512 | return -ENOMEM; | ||
513 | } | ||
514 | |||
515 | adapter->qdio = kzalloc(sizeof(struct zfcp_qdio), GFP_KERNEL); | ||
516 | if (!adapter->qdio) | ||
517 | goto qdio_mem_failed; | ||
518 | |||
519 | adapter->qdio->adapter = adapter; | ||
520 | |||
521 | ccw_device->handler = NULL; | 509 | ccw_device->handler = NULL; |
522 | adapter->ccw_device = ccw_device; | 510 | adapter->ccw_device = ccw_device; |
523 | atomic_set(&adapter->refcount, 0); | 511 | atomic_set(&adapter->refcount, 0); |
524 | 512 | ||
525 | if (zfcp_qdio_allocate(adapter->qdio, ccw_device)) | 513 | if (zfcp_qdio_setup(adapter)) |
526 | goto qdio_allocate_failed; | 514 | goto qdio_failed; |
527 | 515 | ||
528 | if (zfcp_allocate_low_mem_buffers(adapter)) | 516 | if (zfcp_allocate_low_mem_buffers(adapter)) |
529 | goto failed_low_mem_buffers; | 517 | goto low_mem_buffers_failed; |
530 | 518 | ||
531 | if (zfcp_reqlist_alloc(adapter)) | 519 | if (zfcp_reqlist_alloc(adapter)) |
532 | goto failed_low_mem_buffers; | 520 | goto low_mem_buffers_failed; |
533 | 521 | ||
534 | if (zfcp_dbf_adapter_register(adapter)) | 522 | if (zfcp_dbf_adapter_register(adapter)) |
535 | goto debug_register_failed; | 523 | goto debug_register_failed; |
@@ -537,6 +525,9 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
537 | if (zfcp_setup_adapter_work_queue(adapter)) | 525 | if (zfcp_setup_adapter_work_queue(adapter)) |
538 | goto work_queue_failed; | 526 | goto work_queue_failed; |
539 | 527 | ||
528 | if (zfcp_fc_gs_setup(adapter)) | ||
529 | goto generic_services_failed; | ||
530 | |||
540 | init_waitqueue_head(&adapter->remove_wq); | 531 | init_waitqueue_head(&adapter->remove_wq); |
541 | init_waitqueue_head(&adapter->erp_thread_wqh); | 532 | init_waitqueue_head(&adapter->erp_thread_wqh); |
542 | init_waitqueue_head(&adapter->erp_done_wqh); | 533 | init_waitqueue_head(&adapter->erp_done_wqh); |
@@ -547,9 +538,6 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
547 | 538 | ||
548 | spin_lock_init(&adapter->req_list_lock); | 539 | spin_lock_init(&adapter->req_list_lock); |
549 | 540 | ||
550 | spin_lock_init(&adapter->qdio->req_q_lock); | ||
551 | spin_lock_init(&adapter->qdio->stat_lock); | ||
552 | |||
553 | rwlock_init(&adapter->erp_lock); | 541 | rwlock_init(&adapter->erp_lock); |
554 | rwlock_init(&adapter->abort_lock); | 542 | rwlock_init(&adapter->abort_lock); |
555 | 543 | ||
@@ -570,24 +558,23 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
570 | goto sysfs_failed; | 558 | goto sysfs_failed; |
571 | 559 | ||
572 | atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status); | 560 | atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status); |
573 | zfcp_fc_wka_ports_init(adapter); | ||
574 | 561 | ||
575 | if (!zfcp_adapter_scsi_register(adapter)) | 562 | if (!zfcp_adapter_scsi_register(adapter)) |
576 | return 0; | 563 | return 0; |
577 | 564 | ||
578 | sysfs_failed: | 565 | sysfs_failed: |
566 | zfcp_fc_gs_destroy(adapter); | ||
567 | generic_services_failed: | ||
579 | zfcp_destroy_adapter_work_queue(adapter); | 568 | zfcp_destroy_adapter_work_queue(adapter); |
580 | work_queue_failed: | 569 | work_queue_failed: |
581 | zfcp_dbf_adapter_unregister(adapter->dbf); | 570 | zfcp_dbf_adapter_unregister(adapter->dbf); |
582 | debug_register_failed: | 571 | debug_register_failed: |
583 | dev_set_drvdata(&ccw_device->dev, NULL); | 572 | dev_set_drvdata(&ccw_device->dev, NULL); |
584 | kfree(adapter->req_list); | 573 | kfree(adapter->req_list); |
585 | failed_low_mem_buffers: | 574 | low_mem_buffers_failed: |
586 | zfcp_free_low_mem_buffers(adapter); | 575 | zfcp_free_low_mem_buffers(adapter); |
587 | qdio_allocate_failed: | 576 | qdio_failed: |
588 | zfcp_qdio_free(adapter->qdio); | 577 | zfcp_qdio_destroy(adapter->qdio); |
589 | kfree(adapter->qdio); | ||
590 | qdio_mem_failed: | ||
591 | kfree(adapter); | 578 | kfree(adapter); |
592 | return -ENOMEM; | 579 | return -ENOMEM; |
593 | } | 580 | } |
@@ -616,15 +603,14 @@ void zfcp_adapter_dequeue(struct zfcp_adapter *adapter) | |||
616 | if (!retval) | 603 | if (!retval) |
617 | return; | 604 | return; |
618 | 605 | ||
606 | zfcp_fc_gs_destroy(adapter); | ||
619 | zfcp_destroy_adapter_work_queue(adapter); | 607 | zfcp_destroy_adapter_work_queue(adapter); |
620 | zfcp_dbf_adapter_unregister(adapter->dbf); | 608 | zfcp_dbf_adapter_unregister(adapter->dbf); |
621 | zfcp_qdio_free(adapter->qdio); | ||
622 | zfcp_free_low_mem_buffers(adapter); | 609 | zfcp_free_low_mem_buffers(adapter); |
610 | zfcp_qdio_destroy(adapter->qdio); | ||
623 | kfree(adapter->req_list); | 611 | kfree(adapter->req_list); |
624 | kfree(adapter->fc_stats); | 612 | kfree(adapter->fc_stats); |
625 | kfree(adapter->stats_reset_data); | 613 | kfree(adapter->stats_reset_data); |
626 | kfree(adapter->gs); | ||
627 | kfree(adapter->qdio); | ||
628 | kfree(adapter); | 614 | kfree(adapter); |
629 | } | 615 | } |
630 | 616 | ||