summaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-18 22:14:54 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-10-18 22:14:54 -0400
commit972c26bdd6b58e7534473c4f7928584578cf43f4 (patch)
treee32f940cf913ee80ac7ae5e3d92d53f90a6b6552 /include/linux/libata.h
parentb194b4250c2b7e9d762823ac6045316fcd4bf4f9 (diff)
downloadop-kernel-dev-972c26bdd6b58e7534473c4f7928584578cf43f4.zip
op-kernel-dev-972c26bdd6b58e7534473c4f7928584578cf43f4.tar.gz
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.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index d3f58a7..d3dfefe 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);
#endif /* CONFIG_PCI */
+static inline int
+ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc)
+{
+ if (sg == &qc->pad_sgent)
+ return 1;
+ if (qc->pad_len)
+ return 0;
+ if (((sg - qc->__sg) + 1) == qc->n_elem)
+ return 1;
+ return 0;
+}
+
static inline struct scatterlist *
ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
{
OpenPOWER on IntegriCloud