aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2006-02-20 16:56:08 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-02-20 16:56:08 -0500
commit11fff8287fdaeb700df79aa8253650b60c7b21e2 (patch)
treea0b695f44810b4cf8c4b3f81dd25811a10871003 /include/linux/libata.h
parenta5fd79ccd60b7c9cc0221dfaaa950933eff6af99 (diff)
parentf131883e73a8662dc92c3ea371ae9ded0c8f2c37 (diff)
downloadkernel_samsung_aries-11fff8287fdaeb700df79aa8253650b60c7b21e2.zip
kernel_samsung_aries-11fff8287fdaeb700df79aa8253650b60c7b21e2.tar.gz
kernel_samsung_aries-11fff8287fdaeb700df79aa8253650b60c7b21e2.tar.bz2
Merge branch 'upstream'
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 6350088..2558aba 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -619,17 +619,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)
{