diff options
Diffstat (limited to 'include/linux/libata.h')
| -rw-r--r-- | include/linux/libata.h | 16 |
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) | |||
| 616 | } | 616 | } |
| 617 | 617 | ||
| 618 | static inline struct scatterlist * | 618 | static inline struct scatterlist * |
| 619 | ata_qc_first_sg(struct ata_queued_cmd *qc) | ||
| 620 | { | ||
| 621 | if (qc->n_elem) | ||
| 622 | return qc->__sg; | ||
| 623 | if (qc->pad_len) | ||
| 624 | return &qc->pad_sgent; | ||
| 625 | return NULL; | ||
| 626 | } | ||
| 627 | |||
| 628 | static inline struct scatterlist * | ||
| 619 | ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc) | 629 | ata_qc_next_sg(struct scatterlist *sg, struct ata_queued_cmd *qc) |
| 620 | { | 630 | { |
| 621 | if (sg == &qc->pad_sgent) | 631 | if (sg == &qc->pad_sgent) |
| 622 | return NULL; | 632 | return NULL; |
| 623 | if (++sg - qc->__sg < qc->n_elem) | 633 | if (++sg - qc->__sg < qc->n_elem) |
| 624 | return sg; | 634 | return sg; |
| 625 | return qc->pad_len ? &qc->pad_sgent : NULL; | 635 | if (qc->pad_len) |
| 636 | return &qc->pad_sgent; | ||
| 637 | return NULL; | ||
| 626 | } | 638 | } |
| 627 | 639 | ||
| 628 | #define ata_for_each_sg(sg, qc) \ | 640 | #define ata_for_each_sg(sg, qc) \ |
| 629 | for (sg = qc->__sg; sg; sg = ata_qc_next_sg(sg, qc)) | 641 | for (sg = ata_qc_first_sg(qc); sg; sg = ata_qc_next_sg(sg, qc)) |
| 630 | 642 | ||
| 631 | static inline unsigned int ata_tag_valid(unsigned int tag) | 643 | static inline unsigned int ata_tag_valid(unsigned int tag) |
| 632 | { | 644 | { |
