Rev 5056 | Rev 6082 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5056 | Rev 5270 | ||
---|---|---|---|
Line 5... | Line 5... | ||
5 | * |
5 | * |
6 | * This source code is licensed under the GNU General Public License, |
6 | * This source code is licensed under the GNU General Public License, |
7 | * Version 2. See the file COPYING for more details. |
7 | * Version 2. See the file COPYING for more details. |
8 | */ |
8 | */ |
9 | #include |
9 | #include |
- | 10 | #include |
|
10 | #include |
11 | #include |
Line 11... | Line 12... | ||
11 | 12 | ||
12 | /** |
13 | /** |
13 | * sg_next - return the next scatterlist entry in a list |
14 | * sg_next - return the next scatterlist entry in a list |
Line 68... | Line 69... | ||
68 | * exist from @sgl@. |
69 | * exist from @sgl@. |
69 | * |
70 | * |
70 | **/ |
71 | **/ |
71 | struct scatterlist *sg_last(struct scatterlist *sgl, unsigned int nents) |
72 | struct scatterlist *sg_last(struct scatterlist *sgl, unsigned int nents) |
72 | { |
73 | { |
73 | #ifndef ARCH_HAS_SG_CHAIN |
74 | #ifndef CONFIG_ARCH_HAS_SG_CHAIN |
74 | struct scatterlist *ret = &sgl[nents - 1]; |
75 | struct scatterlist *ret = &sgl[nents - 1]; |
75 | #else |
76 | #else |
76 | struct scatterlist *sg, *ret = NULL; |
77 | struct scatterlist *sg, *ret = NULL; |
77 | unsigned int i; |
78 | unsigned int i; |
Line 180... | Line 181... | ||
180 | sg_size = alloc_size; |
181 | sg_size = alloc_size; |
181 | next = NULL; |
182 | next = NULL; |
182 | } |
183 | } |
Line 183... | Line 184... | ||
183 | 184 | ||
184 | table->orig_nents -= sg_size; |
185 | table->orig_nents -= sg_size; |
185 | if (!skip_first_chunk) { |
- | |
186 | free_fn(sgl, alloc_size); |
186 | if (skip_first_chunk) |
187 | skip_first_chunk = false; |
187 | skip_first_chunk = false; |
- | 188 | else |
|
188 | } |
189 | free_fn(sgl, alloc_size); |
189 | sgl = next; |
190 | sgl = next; |
Line 190... | Line 191... | ||
190 | } |
191 | } |
191 | 192 | ||
Line 232... | Line 233... | ||
232 | 233 | ||
Line 233... | Line 234... | ||
233 | memset(table, 0, sizeof(*table)); |
234 | memset(table, 0, sizeof(*table)); |
234 | 235 | ||
235 | if (nents == 0) |
236 | if (nents == 0) |
236 | return -EINVAL; |
237 | return -EINVAL; |
237 | #ifndef ARCH_HAS_SG_CHAIN |
238 | #ifndef CONFIG_ARCH_HAS_SG_CHAIN |
238 | if (WARN_ON_ONCE(nents > max_ents)) |
239 | if (WARN_ON_ONCE(nents > max_ents)) |
Line 239... | Line 240... | ||
239 | return -EINVAL; |
240 | return -EINVAL; |