diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-03 15:43:21 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-11-03 15:43:21 -0400 |
commit | 160acc2e899f26356bde92bc257253b7ca78f0c3 (patch) | |
tree | c60782685ac0fdf4b2d6278c4be639181dd65126 /include/linux | |
parent | a7e1e001f432d5960b929787a2a261cf5a7ddac5 (diff) | |
parent | c46f2334c84c2b26baa64d42d75ddc5fab38c3dc (diff) |
Merge branch 'sg' of git://git.kernel.dk/linux-2.6-block
* 'sg' of git://git.kernel.dk/linux-2.6-block:
[SG] Get rid of __sg_mark_end()
cleanup asm/scatterlist.h includes
SG: Make sg_init_one() use general table init functions
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/scatterlist.h | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 32326c293d7b..259735044148 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
@@ -188,43 +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 | **/ |
198 | static inline void sg_mark_end(struct scatterlist *sgl, unsigned int nents) | 198 | static inline void sg_mark_end(struct scatterlist *sg) |
199 | { | 199 | { |
200 | sgl[nents - 1].page_link = 0x02; | ||
201 | } | ||
202 | |||
203 | static inline void __sg_mark_end(struct scatterlist *sg) | ||
204 | { | ||
205 | sg->page_link |= 0x02; | ||
206 | } | ||
207 | |||
208 | /** | ||
209 | * sg_init_one - Initialize a single entry sg list | ||
210 | * @sg: SG entry | ||
211 | * @buf: Virtual address for IO | ||
212 | * @buflen: IO length | ||
213 | * | ||
214 | * Notes: | ||
215 | * This should not be used on a single entry that is part of a larger | ||
216 | * table. Use sg_init_table() for that. | ||
217 | * | ||
218 | **/ | ||
219 | static inline void sg_init_one(struct scatterlist *sg, const void *buf, | ||
220 | unsigned int buflen) | ||
221 | { | ||
222 | memset(sg, 0, sizeof(*sg)); | ||
223 | #ifdef CONFIG_DEBUG_SG | 200 | #ifdef CONFIG_DEBUG_SG |
224 | sg->sg_magic = SG_MAGIC; | 201 | BUG_ON(sg->sg_magic != SG_MAGIC); |
225 | #endif | 202 | #endif |
226 | sg_mark_end(sg, 1); | 203 | /* |
227 | sg_set_buf(sg, buf, buflen); | 204 | * Set termination bit, clear potential chain bit |
205 | */ | ||
206 | sg->page_link |= 0x02; | ||
207 | sg->page_link &= ~0x01; | ||
228 | } | 208 | } |
229 | 209 | ||
230 | /** | 210 | /** |
@@ -240,7 +220,6 @@ static inline void sg_init_one(struct scatterlist *sg, const void *buf, | |||
240 | static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents) | 220 | static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents) |
241 | { | 221 | { |
242 | memset(sgl, 0, sizeof(*sgl) * nents); | 222 | memset(sgl, 0, sizeof(*sgl) * nents); |
243 | sg_mark_end(sgl, nents); | ||
244 | #ifdef CONFIG_DEBUG_SG | 223 | #ifdef CONFIG_DEBUG_SG |
245 | { | 224 | { |
246 | unsigned int i; | 225 | unsigned int i; |
@@ -248,6 +227,25 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents) | |||
248 | sgl[i].sg_magic = SG_MAGIC; | 227 | sgl[i].sg_magic = SG_MAGIC; |
249 | } | 228 | } |
250 | #endif | 229 | #endif |
230 | sg_mark_end(&sgl[nents - 1]); | ||
231 | } | ||
232 | |||
233 | /** | ||
234 | * sg_init_one - Initialize a single entry sg list | ||
235 | * @sg: SG entry | ||
236 | * @buf: Virtual address for IO | ||
237 | * @buflen: IO length | ||
238 | * | ||
239 | * Notes: | ||
240 | * This should not be used on a single entry that is part of a larger | ||
241 | * table. Use sg_init_table() for that. | ||
242 | * | ||
243 | **/ | ||
244 | static inline void sg_init_one(struct scatterlist *sg, const void *buf, | ||
245 | unsigned int buflen) | ||
246 | { | ||
247 | sg_init_table(sg, 1); | ||
248 | sg_set_buf(sg, buf, buflen); | ||
251 | } | 249 | } |
252 | 250 | ||
253 | /** | 251 | /** |