aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/scatterlist.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/scatterlist.h')
-rw-r--r--include/linux/scatterlist.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 457123171389..32326c293d7b 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -150,7 +150,7 @@ static inline struct scatterlist *sg_last(struct scatterlist *sgl,
150 struct scatterlist *ret = &sgl[nents - 1]; 150 struct scatterlist *ret = &sgl[nents - 1];
151#else 151#else
152 struct scatterlist *sg, *ret = NULL; 152 struct scatterlist *sg, *ret = NULL;
153 int i; 153 unsigned int i;
154 154
155 for_each_sg(sgl, sg, nents, i) 155 for_each_sg(sgl, sg, nents, i)
156 ret = sg; 156 ret = sg;
@@ -179,7 +179,11 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
179#ifndef ARCH_HAS_SG_CHAIN 179#ifndef ARCH_HAS_SG_CHAIN
180 BUG(); 180 BUG();
181#endif 181#endif
182 prv[prv_nents - 1].page_link = (unsigned long) sgl | 0x01; 182 /*
183 * Set lowest bit to indicate a link pointer, and make sure to clear
184 * the termination bit if it happens to be set.
185 */
186 prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02;
183} 187}
184 188
185/** 189/**
@@ -239,7 +243,7 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
239 sg_mark_end(sgl, nents); 243 sg_mark_end(sgl, nents);
240#ifdef CONFIG_DEBUG_SG 244#ifdef CONFIG_DEBUG_SG
241 { 245 {
242 int i; 246 unsigned int i;
243 for (i = 0; i < nents; i++) 247 for (i = 0; i < nents; i++)
244 sgl[i].sg_magic = SG_MAGIC; 248 sgl[i].sg_magic = SG_MAGIC;
245 } 249 }