diff options
author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-18 22:14:54 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-18 22:14:54 -0400 |
commit | 972c26bdd6b58e7534473c4f7928584578cf43f4 (patch) | |
tree | e32f940cf913ee80ac7ae5e3d92d53f90a6b6552 /drivers/scsi/sata_mv.c | |
parent | b194b4250c2b7e9d762823ac6045316fcd4bf4f9 (diff) |
libata: add ata_sg_is_last() helper, use it in several drivers
Diffstat (limited to 'drivers/scsi/sata_mv.c')
-rw-r--r-- | drivers/scsi/sata_mv.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index d457f5673476..be7c378dcd36 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -785,22 +785,24 @@ static void mv_port_stop(struct ata_port *ap) | |||
785 | static void mv_fill_sg(struct ata_queued_cmd *qc) | 785 | static void mv_fill_sg(struct ata_queued_cmd *qc) |
786 | { | 786 | { |
787 | struct mv_port_priv *pp = qc->ap->private_data; | 787 | struct mv_port_priv *pp = qc->ap->private_data; |
788 | unsigned int i; | 788 | unsigned int i = 0; |
789 | struct scatterlist *sg; | ||
789 | 790 | ||
790 | for (i = 0; i < qc->n_elem; i++) { | 791 | ata_for_each_sg(sg, qc) { |
791 | u32 sg_len; | 792 | u32 sg_len; |
792 | dma_addr_t addr; | 793 | dma_addr_t addr; |
793 | 794 | ||
794 | addr = sg_dma_address(&qc->sg[i]); | 795 | addr = sg_dma_address(sg); |
795 | sg_len = sg_dma_len(&qc->sg[i]); | 796 | sg_len = sg_dma_len(sg); |
796 | 797 | ||
797 | pp->sg_tbl[i].addr = cpu_to_le32(addr & 0xffffffff); | 798 | pp->sg_tbl[i].addr = cpu_to_le32(addr & 0xffffffff); |
798 | pp->sg_tbl[i].addr_hi = cpu_to_le32((addr >> 16) >> 16); | 799 | pp->sg_tbl[i].addr_hi = cpu_to_le32((addr >> 16) >> 16); |
799 | assert(0 == (sg_len & ~MV_DMA_BOUNDARY)); | 800 | assert(0 == (sg_len & ~MV_DMA_BOUNDARY)); |
800 | pp->sg_tbl[i].flags_size = cpu_to_le32(sg_len); | 801 | pp->sg_tbl[i].flags_size = cpu_to_le32(sg_len); |
801 | } | 802 | if (ata_sg_is_last(sg, qc)) |
802 | if (0 < qc->n_elem) { | 803 | pp->sg_tbl[i].flags_size |= cpu_to_le32(EPRD_FLAG_END_OF_TBL); |
803 | pp->sg_tbl[qc->n_elem - 1].flags_size |= EPRD_FLAG_END_OF_TBL; | 804 | |
805 | i++; | ||
804 | } | 806 | } |
805 | } | 807 | } |
806 | 808 | ||