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) |
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) | |||
416 | static inline void sil24_fill_sg(struct ata_queued_cmd *qc, | 416 | static inline void sil24_fill_sg(struct ata_queued_cmd *qc, |
417 | struct sil24_cmd_block *cb) | 417 | struct sil24_cmd_block *cb) |
418 | { | 418 | { |
419 | struct scatterlist *sg = qc->sg; | ||
420 | struct sil24_sge *sge = cb->sge; | 419 | struct sil24_sge *sge = cb->sge; |
421 | unsigned i; | 420 | struct scatterlist *sg; |
421 | unsigned int idx = 0; | ||
422 | 422 | ||
423 | for (i = 0; i < qc->n_elem; i++, sg++, sge++) { | 423 | ata_for_each_sg(sg, qc) { |
424 | sge->addr = cpu_to_le64(sg_dma_address(sg)); | 424 | sge->addr = cpu_to_le64(sg_dma_address(sg)); |
425 | sge->cnt = cpu_to_le32(sg_dma_len(sg)); | 425 | sge->cnt = cpu_to_le32(sg_dma_len(sg)); |
426 | sge->flags = 0; | 426 | if (ata_sg_is_last(sg, qc)) |
427 | sge->flags = i < qc->n_elem - 1 ? 0 : cpu_to_le32(SGE_TRM); | 427 | sge->flags = cpu_to_le32(SGE_TRM); |
428 | else | ||
429 | sge->flags = 0; | ||
430 | |||
431 | sge++; | ||
432 | idx++; | ||
428 | } | 433 | } |
429 | } | 434 | } |
430 | 435 | ||