diff --git a/scst/include/scst.h b/scst/include/scst.h index f3c6f062c..47e965877 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -3737,12 +3737,6 @@ static inline void sg_set_page(struct scatterlist *sg, struct page *page, sg->length = len; } -#ifndef for_each_sg -/* See also commit 96b418c960af0d5c7185ff5c4af9376eb37ac9d3 */ -#define for_each_sg(sglist, sg, nr, __i) \ - for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next(sg)) -#endif - #endif /* __BACKPORT_LINUX_SCATTERLIST_H_TO_2_6_23__ */ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) */ @@ -3756,6 +3750,18 @@ static inline struct scatterlist *sg_next_inline(struct scatterlist *sg) return sg; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) +#ifndef __BACKPORT_LINUX_SCATTERLIST_H_TO_2_6_23__ + +#ifndef for_each_sg +/* See also commit 96b418c960af0d5c7185ff5c4af9376eb37ac9d3 */ +#define for_each_sg(sglist, sg, nr, __i) \ + for (__i = 0, sg = (sglist); __i < (nr); __i++, sg = sg_next_inline(sg)) +#endif + +#endif /* __BACKPORT_LINUX_SCATTERLIST_H_TO_2_6_23__ */ +#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24) */ + static inline void sg_clear(struct scatterlist *sg) { memset(sg, 0, sizeof(*sg));