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_sil24.c | |
parent | b194b4250c2b7e9d762823ac6045316fcd4bf4f9 (diff) | |
download | linux-972c26bdd6b58e7534473c4f7928584578cf43f4.tar.gz linux-972c26bdd6b58e7534473c4f7928584578cf43f4.tar.bz2 linux-972c26bdd6b58e7534473c4f7928584578cf43f4.zip |
libata: add ata_sg_is_last() helper, use it in several drivers
Diffstat (limited to 'drivers/scsi/sata_sil24.c')
-rw-r--r-- | drivers/scsi/sata_sil24.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c index 19857814d69f..e16d1815cda0 100644 --- a/drivers/scsi/sata_sil24.c +++ b/drivers/scsi/sata_sil24.c @@ -416,15 +416,20 @@ static void sil24_phy_reset(struct ata_port *ap) static inline void sil24_fill_sg(struct ata_queued_cmd *qc, struct sil24_cmd_block *cb) { - struct scatterlist *sg = qc->sg; struct sil24_sge *sge = cb->sge; - unsigned i; + struct scatterlist *sg; + unsigned int idx = 0; - for (i = 0; i < qc->n_elem; i++, sg++, sge++) { + ata_for_each_sg(sg, qc) { sge->addr = cpu_to_le64(sg_dma_address(sg)); sge->cnt = cpu_to_le32(sg_dma_len(sg)); - sge->flags = 0; - sge->flags = i < qc->n_elem - 1 ? 0 : cpu_to_le32(SGE_TRM); + if (ata_sg_is_last(sg, qc)) + sge->flags = cpu_to_le32(SGE_TRM); + else + sge->flags = 0; + + sge++; + idx++; } } |