aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/scatterlist.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index d5e1876daf3f..259735044148 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -188,21 +188,23 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
188 188
189/** 189/**
190 * sg_mark_end - Mark the end of the scatterlist 190 * sg_mark_end - Mark the end of the scatterlist
191 * @sgl: Scatterlist 191 * @sg: SG entryScatterlist
192 * @nents: Number of entries in sgl
193 * 192 *
194 * Description: 193 * Description:
195 * Marks the last entry as the termination point for sg_next() 194 * Marks the passed in sg entry as the termination point for the sg
195 * table. A call to sg_next() on this entry will return NULL.
196 * 196 *
197 **/ 197 **/
198static inline void sg_mark_end(struct scatterlist *sgl, unsigned int nents) 198static inline void sg_mark_end(struct scatterlist *sg)
199{
200 sgl[nents - 1].page_link = 0x02;
201}
202
203static inline void __sg_mark_end(struct scatterlist *sg)
204{ 199{
200#ifdef CONFIG_DEBUG_SG
201 BUG_ON(sg->sg_magic != SG_MAGIC);
202#endif
203 /*
204 * Set termination bit, clear potential chain bit
205 */
205 sg->page_link |= 0x02; 206 sg->page_link |= 0x02;
207 sg->page_link &= ~0x01;
206} 208}
207 209
208/** 210/**
@@ -218,7 +220,6 @@ static inline void __sg_mark_end(struct scatterlist *sg)
218static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents) 220static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
219{ 221{
220 memset(sgl, 0, sizeof(*sgl) * nents); 222 memset(sgl, 0, sizeof(*sgl) * nents);
221 sg_mark_end(sgl, nents);
222#ifdef CONFIG_DEBUG_SG 223#ifdef CONFIG_DEBUG_SG
223 { 224 {
224 unsigned int i; 225 unsigned int i;
@@ -226,6 +227,7 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
226 sgl[i].sg_magic = SG_MAGIC; 227 sgl[i].sg_magic = SG_MAGIC;
227 } 228 }
228#endif 229#endif
230 sg_mark_end(&sgl[nents - 1]);
229} 231}
230 232
231/** 233/**