summaryrefslogtreecommitdiff
path: root/include/linux/libata.h
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2006-02-21 00:55:56 +0300
committerJeff Garzik <jgarzik@pobox.com>2006-02-21 00:55:56 +0300
commitf131883e73a8662dc92c3ea371ae9ded0c8f2c37 (patch)
treeacd45903e321cf04df825da8d05ee06dabc1d8aa /include/linux/libata.h
parentccbe6d5ee0eb3182675ef1c84322810fd884586d (diff)
parent2e242fa994428bd1a40b6a7e97430413246d0a16 (diff)
downloadlinux-f131883e73a8662dc92c3ea371ae9ded0c8f2c37.tar.xz
Merge branch 'upstream-fixes'
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 0d6bf50ad029..66b6847225df 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -616,17 +616,29 @@ ata_sg_is_last(struct scatterlist *sg, struct ata_queued_cmd *qc)
}
static inline struct scatterlist *
+ata_qc_first_sg(struct ata_queued_cmd *qc)
+{
+ if (qc->n_elem)
+ return qc->__sg;
+ if (qc->pad_len)
+ return &qc->pad_sgent;
+ return NULL;
+}
+
+static inline struct scatterlist *
ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc)
{
if (sg == &qc->pad_sgent)
return NULL;
if (++sg - qc->__sg < qc->n_elem)
return sg;
- return qc->pad_len ? &qc->pad_sgent : NULL;
+ if (qc->pad_len)
+ return &qc->pad_sgent;
+ return NULL;
}
#define ata_for_each_sg(sg, qc) \
- for (sg = qc->__sg; sg; sg = ata_qc_next_sg(sg, qc))
+ for (sg = ata_qc_first_sg(qc); sg; sg = ata_qc_next_sg(sg, qc))
static inline unsigned int ata_tag_valid(unsigned int tag)
{