diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-23 15:04:34 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-23 15:04:34 -0400 |
| commit | 20b7997e8abdf338dcc27fb4f1333c4973a7f113 (patch) | |
| tree | d060f0ba9940781ca2351c09f4638640584052a5 /include | |
| parent | 5554b35933245e95710d709175e14c02cbc956a4 (diff) | |
| parent | 7659150c60839a2bd31f74e866374abb9be17e43 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/drzeus/mmc:
sdhci: highmem capable PIO routines
sg: reimplement sg mapping iterator
mmc_test: print message when attaching to card
mmc: Remove Russell as primecell mci maintainer
mmc_block: bounce buffer highmem support
sdhci: fix bad warning from commit c8b3e02
sdhci: add warnings for bad buffers in ADMA path
mmc_test: test oversized sg lists
mmc_test: highmem tests
s3cmci: ensure host stopped on machine shutdown
au1xmmc: suspend/resume implementation
s3cmci: fixes for section mismatch warnings
pxamci: trivial fix of DMA alignment register bit clearing
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/scatterlist.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h index 71fc81360048..e5996984ddd0 100644 --- a/include/linux/scatterlist.h +++ b/include/linux/scatterlist.h | |||
| @@ -224,4 +224,42 @@ size_t sg_copy_to_buffer(struct scatterlist *sgl, unsigned int nents, | |||
| 224 | */ | 224 | */ |
| 225 | #define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist)) | 225 | #define SG_MAX_SINGLE_ALLOC (PAGE_SIZE / sizeof(struct scatterlist)) |
| 226 | 226 | ||
| 227 | |||
| 228 | /* | ||
| 229 | * Mapping sg iterator | ||
| 230 | * | ||
| 231 | * Iterates over sg entries mapping page-by-page. On each successful | ||
| 232 | * iteration, @miter->page points to the mapped page and | ||
| 233 | * @miter->length bytes of data can be accessed at @miter->addr. As | ||
| 234 | * long as an interation is enclosed between start and stop, the user | ||
| 235 | * is free to choose control structure and when to stop. | ||
| 236 | * | ||
| 237 | * @miter->consumed is set to @miter->length on each iteration. It | ||
| 238 | * can be adjusted if the user can't consume all the bytes in one go. | ||
| 239 | * Also, a stopped iteration can be resumed by calling next on it. | ||
| 240 | * This is useful when iteration needs to release all resources and | ||
| 241 | * continue later (e.g. at the next interrupt). | ||
| 242 | */ | ||
| 243 | |||
| 244 | #define SG_MITER_ATOMIC (1 << 0) /* use kmap_atomic */ | ||
| 245 | |||
| 246 | struct sg_mapping_iter { | ||
| 247 | /* the following three fields can be accessed directly */ | ||
| 248 | struct page *page; /* currently mapped page */ | ||
| 249 | void *addr; /* pointer to the mapped area */ | ||
| 250 | size_t length; /* length of the mapped area */ | ||
| 251 | size_t consumed; /* number of consumed bytes */ | ||
| 252 | |||
| 253 | /* these are internal states, keep away */ | ||
| 254 | struct scatterlist *__sg; /* current entry */ | ||
| 255 | unsigned int __nents; /* nr of remaining entries */ | ||
| 256 | unsigned int __offset; /* offset within sg */ | ||
| 257 | unsigned int __flags; | ||
| 258 | }; | ||
| 259 | |||
| 260 | void sg_miter_start(struct sg_mapping_iter *miter, struct scatterlist *sgl, | ||
| 261 | unsigned int nents, unsigned int flags); | ||
| 262 | bool sg_miter_next(struct sg_mapping_iter *miter); | ||
| 263 | void sg_miter_stop(struct sg_mapping_iter *miter); | ||
| 264 | |||
| 227 | #endif /* _LINUX_SCATTERLIST_H */ | 265 | #endif /* _LINUX_SCATTERLIST_H */ |
