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 /include/linux/libata.h | |
| parent | b194b4250c2b7e9d762823ac6045316fcd4bf4f9 (diff) | |
libata: add ata_sg_is_last() helper, use it in several drivers
Diffstat (limited to 'include/linux/libata.h')
| -rw-r--r-- | include/linux/libata.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index d3f58a796c3a..d3dfefefabec 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -480,6 +480,18 @@ extern int pci_test_config_bits(struct pci_dev *pdev, struct pci_bits *bits); | |||
| 480 | #endif /* CONFIG_PCI */ | 480 | #endif /* CONFIG_PCI */ |
| 481 | 481 | ||
| 482 | 482 | ||
| 483 | static inline int | ||
| 484 | ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc) | ||
| 485 | { | ||
| 486 | if (sg == &qc->pad_sgent) | ||
| 487 | return 1; | ||
| 488 | if (qc->pad_len) | ||
| 489 | return 0; | ||
| 490 | if (((sg - qc->__sg) + 1) == qc->n_elem) | ||
| 491 | return 1; | ||
| 492 | return 0; | ||
| 493 | } | ||
| 494 | |||
| 483 | static inline struct scatterlist * | 495 | static inline struct scatterlist * |
| 484 | ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc) | 496 | ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc) |
| 485 | { | 497 | { |
