aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_sli.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-23 15:29:16 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-23 15:29:16 -0500
commitb23c9cc0ce652089a2f0af8c7f1541f10dc9b5db (patch)
treed2e429bbb74c268c071790761e4a2b59d96ea3f7 /drivers/scsi/lpfc/lpfc_sli.c
parent1e8352784abaedb424e63fa700e93e6c1307785f (diff)
parentcfb37ae1e9d31fe2c1d21734ab51405e0c3afb7e (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6: (25 commits) [SCSI] qlogicpt: section fixes [SCSI] mvsas: convert from rough draft to working driver [SCSI] mvsas: Add Marvell 6440 SAS/SATA driver [SCSI] libsas: correctly flush the LU queue on error recovery [SCSI] aic94xx: fix sequencer hang on error recovery [SCSI] st: compile fix when DEBUG set to one [SCSI] stex: stex_internal_copy should be called with sg_count in struct st_ccb [SCSI] stex: stex_direct_copy shouldn't call dma_map_sg [SCSI] lpfc: Balance locking [SCSI] qla4xxx: fix up residual handling [SCSI] libsas: fix error handling [SCSI] arcmsr: fix message allocation [SCSI] mptbase: fix use-after-free's [SCSI] iscsi transport: make 2 functions static [SCSI] lpfc: make lpfc_disable_node() static [SCSI] ips: fix data buffer accessors conversion bug [SCSI] gdth: don't call pci_free_consistent under spinlock [SCSI] qla2xxx: fix compile warning for printk format [SCSI] aic7xx: mitigate HOST_MSG_LOOP invalid SCB ff panic [SCSI] scsi_debug: disable clustering ...
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_sli.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_sli.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
index f53206411cd8..fc0d9501aba6 100644
--- a/drivers/scsi/lpfc/lpfc_sli.c
+++ b/drivers/scsi/lpfc/lpfc_sli.c
@@ -648,28 +648,24 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
648 unsigned long flags; 648 unsigned long flags;
649 struct hbq_dmabuf *hbq_buffer; 649 struct hbq_dmabuf *hbq_buffer;
650 650
651 if (!phba->hbqs[hbqno].hbq_alloc_buffer) { 651 if (!phba->hbqs[hbqno].hbq_alloc_buffer)
652 return 0; 652 return 0;
653 }
654 653
655 start = phba->hbqs[hbqno].buffer_count; 654 start = phba->hbqs[hbqno].buffer_count;
656 end = count + start; 655 end = count + start;
657 if (end > lpfc_hbq_defs[hbqno]->entry_count) { 656 if (end > lpfc_hbq_defs[hbqno]->entry_count)
658 end = lpfc_hbq_defs[hbqno]->entry_count; 657 end = lpfc_hbq_defs[hbqno]->entry_count;
659 }
660 658
661 /* Check whether HBQ is still in use */ 659 /* Check whether HBQ is still in use */
662 spin_lock_irqsave(&phba->hbalock, flags); 660 spin_lock_irqsave(&phba->hbalock, flags);
663 if (!phba->hbq_in_use) { 661 if (!phba->hbq_in_use)
664 spin_unlock_irqrestore(&phba->hbalock, flags); 662 goto out;
665 return 0;
666 }
667 663
668 /* Populate HBQ entries */ 664 /* Populate HBQ entries */
669 for (i = start; i < end; i++) { 665 for (i = start; i < end; i++) {
670 hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba); 666 hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
671 if (!hbq_buffer) 667 if (!hbq_buffer)
672 return 1; 668 goto err;
673 hbq_buffer->tag = (i | (hbqno << 16)); 669 hbq_buffer->tag = (i | (hbqno << 16));
674 if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) 670 if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer))
675 phba->hbqs[hbqno].buffer_count++; 671 phba->hbqs[hbqno].buffer_count++;
@@ -677,8 +673,12 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
677 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer); 673 (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
678 } 674 }
679 675
676 out:
680 spin_unlock_irqrestore(&phba->hbalock, flags); 677 spin_unlock_irqrestore(&phba->hbalock, flags);
681 return 0; 678 return 0;
679 err:
680 spin_unlock_irqrestore(&phba->hbalock, flags);
681 return 1;
682} 682}
683 683
684int 684int