aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_aux.c
diff options
context:
space:
mode:
authorSwen Schillig <swen@vnet.ibm.com>2008-06-10 12:20:57 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-07-12 09:22:25 -0400
commit00bab91066a49468bfa4f6d5c8ad5e9ec53b7ea3 (patch)
treea5ce7bfe5ad290c339f669b3596b75f5238157c6 /drivers/s390/scsi/zfcp_aux.c
parentfa04c2816883a49ec518514f6c19767d54be20b5 (diff)
[SCSI] zfcp: Cleanup qdio code
Cleanup the interface code from zfcp to qdio. Also move code that belongs to the qdio interface from the erp to the qdio file. 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@HansenPartnership.com>
Diffstat (limited to 'drivers/s390/scsi/zfcp_aux.c')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c45
1 files changed, 7 insertions, 38 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 735f7af43d6a..7084a6ae1096 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -606,7 +606,6 @@ static void _zfcp_status_read_scheduler(struct work_struct *work)
606struct zfcp_adapter * 606struct zfcp_adapter *
607zfcp_adapter_enqueue(struct ccw_device *ccw_device) 607zfcp_adapter_enqueue(struct ccw_device *ccw_device)
608{ 608{
609 int retval = 0;
610 struct zfcp_adapter *adapter; 609 struct zfcp_adapter *adapter;
611 610
612 /* 611 /*
@@ -627,19 +626,11 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device)
627 /* save ccw_device pointer */ 626 /* save ccw_device pointer */
628 adapter->ccw_device = ccw_device; 627 adapter->ccw_device = ccw_device;
629 628
630 retval = zfcp_qdio_allocate_queues(adapter); 629 if (zfcp_qdio_allocate(adapter))
631 if (retval)
632 goto queues_alloc_failed;
633
634 retval = zfcp_qdio_allocate(adapter);
635 if (retval)
636 goto qdio_allocate_failed; 630 goto qdio_allocate_failed;
637 631
638 retval = zfcp_allocate_low_mem_buffers(adapter); 632 if (zfcp_allocate_low_mem_buffers(adapter))
639 if (retval) {
640 ZFCP_LOG_INFO("error: pool allocation failed\n");
641 goto failed_low_mem_buffers; 633 goto failed_low_mem_buffers;
642 }
643 634
644 /* initialise reference count stuff */ 635 /* initialise reference count stuff */
645 atomic_set(&adapter->refcount, 0); 636 atomic_set(&adapter->refcount, 0);
@@ -653,11 +644,8 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device)
653 644
654 /* initialize list of fsf requests */ 645 /* initialize list of fsf requests */
655 spin_lock_init(&adapter->req_list_lock); 646 spin_lock_init(&adapter->req_list_lock);
656 retval = zfcp_reqlist_alloc(adapter); 647 if (zfcp_reqlist_alloc(adapter))
657 if (retval) {
658 ZFCP_LOG_INFO("request list initialization failed\n");
659 goto failed_low_mem_buffers; 648 goto failed_low_mem_buffers;
660 }
661 649
662 /* initialize debug locks */ 650 /* initialize debug locks */
663 651
@@ -666,8 +654,7 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device)
666 spin_lock_init(&adapter->scsi_dbf_lock); 654 spin_lock_init(&adapter->scsi_dbf_lock);
667 spin_lock_init(&adapter->rec_dbf_lock); 655 spin_lock_init(&adapter->rec_dbf_lock);
668 656
669 retval = zfcp_adapter_debug_register(adapter); 657 if (zfcp_adapter_debug_register(adapter))
670 if (retval)
671 goto debug_register_failed; 658 goto debug_register_failed;
672 659
673 /* initialize error recovery stuff */ 660 /* initialize error recovery stuff */
@@ -685,7 +672,7 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device)
685 init_waitqueue_head(&adapter->erp_done_wqh); 672 init_waitqueue_head(&adapter->erp_done_wqh);
686 673
687 /* initialize lock of associated request queue */ 674 /* initialize lock of associated request queue */
688 rwlock_init(&adapter->request_queue.queue_lock); 675 rwlock_init(&adapter->req_q.lock);
689 INIT_WORK(&adapter->stat_work, _zfcp_status_read_scheduler); 676 INIT_WORK(&adapter->stat_work, _zfcp_status_read_scheduler);
690 677
691 /* mark adapter unusable as long as sysfs registration is not complete */ 678 /* mark adapter unusable as long as sysfs registration is not complete */
@@ -723,12 +710,8 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device)
723 zfcp_reqlist_free(adapter); 710 zfcp_reqlist_free(adapter);
724 failed_low_mem_buffers: 711 failed_low_mem_buffers:
725 zfcp_free_low_mem_buffers(adapter); 712 zfcp_free_low_mem_buffers(adapter);
726 if (qdio_free(ccw_device) != 0)
727 ZFCP_LOG_NORMAL("bug: qdio_free for adapter %s failed\n",
728 zfcp_get_busid_by_adapter(adapter));
729 qdio_allocate_failed: 713 qdio_allocate_failed:
730 zfcp_qdio_free_queues(adapter); 714 zfcp_qdio_free(adapter);
731 queues_alloc_failed:
732 kfree(adapter); 715 kfree(adapter);
733 adapter = NULL; 716 adapter = NULL;
734 out: 717 out:
@@ -757,10 +740,6 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
757 retval = zfcp_reqlist_isempty(adapter); 740 retval = zfcp_reqlist_isempty(adapter);
758 spin_unlock_irqrestore(&adapter->req_list_lock, flags); 741 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
759 if (!retval) { 742 if (!retval) {
760 ZFCP_LOG_NORMAL("bug: adapter %s (%p) still in use, "
761 "%i requests outstanding\n",
762 zfcp_get_busid_by_adapter(adapter), adapter,
763 atomic_read(&adapter->reqs_active));
764 retval = -EBUSY; 743 retval = -EBUSY;
765 goto out; 744 goto out;
766 } 745 }
@@ -775,19 +754,9 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
775 /* decrease number of adapters in list */ 754 /* decrease number of adapters in list */
776 zfcp_data.adapters--; 755 zfcp_data.adapters--;
777 756
778 ZFCP_LOG_TRACE("adapter %s (%p) removed from list, " 757 zfcp_qdio_free(adapter);
779 "%i adapters still in list\n",
780 zfcp_get_busid_by_adapter(adapter),
781 adapter, zfcp_data.adapters);
782
783 retval = qdio_free(adapter->ccw_device);
784 if (retval)
785 ZFCP_LOG_NORMAL("bug: qdio_free for adapter %s failed\n",
786 zfcp_get_busid_by_adapter(adapter));
787 758
788 zfcp_free_low_mem_buffers(adapter); 759 zfcp_free_low_mem_buffers(adapter);
789 /* free memory of adapter data structure and queues */
790 zfcp_qdio_free_queues(adapter);
791 zfcp_reqlist_free(adapter); 760 zfcp_reqlist_free(adapter);
792 kfree(adapter->fc_stats); 761 kfree(adapter->fc_stats);
793 kfree(adapter->stats_reset_data); 762 kfree(adapter->stats_reset_data);