Lines Matching refs:len
90 unsigned int len, unsigned int off) in kfifo_copy_in() argument
100 len *= esize; in kfifo_copy_in()
102 l = min(len, size - off); in kfifo_copy_in()
105 memcpy(fifo->data, src + l, len - l); in kfifo_copy_in()
114 const void *buf, unsigned int len) in __kfifo_in() argument
119 if (len > l) in __kfifo_in()
120 len = l; in __kfifo_in()
122 kfifo_copy_in(fifo, buf, len, fifo->in); in __kfifo_in()
123 fifo->in += len; in __kfifo_in()
124 return len; in __kfifo_in()
129 unsigned int len, unsigned int off) in kfifo_copy_out() argument
139 len *= esize; in kfifo_copy_out()
141 l = min(len, size - off); in kfifo_copy_out()
144 memcpy(dst + l, fifo->data, len - l); in kfifo_copy_out()
153 void *buf, unsigned int len) in __kfifo_out_peek() argument
158 if (len > l) in __kfifo_out_peek()
159 len = l; in __kfifo_out_peek()
161 kfifo_copy_out(fifo, buf, len, fifo->out); in __kfifo_out_peek()
162 return len; in __kfifo_out_peek()
167 void *buf, unsigned int len) in __kfifo_out() argument
169 len = __kfifo_out_peek(fifo, buf, len); in __kfifo_out()
170 fifo->out += len; in __kfifo_out()
171 return len; in __kfifo_out()
176 const void __user *from, unsigned int len, unsigned int off, in kfifo_copy_from_user() argument
188 len *= esize; in kfifo_copy_from_user()
190 l = min(len, size - off); in kfifo_copy_from_user()
194 ret = DIV_ROUND_UP(ret + len - l, esize); in kfifo_copy_from_user()
196 ret = copy_from_user(fifo->data, from + l, len - l); in kfifo_copy_from_user()
205 *copied = len - ret * esize; in kfifo_copy_from_user()
211 unsigned long len, unsigned int *copied) in __kfifo_from_user() argument
219 len /= esize; in __kfifo_from_user()
222 if (len > l) in __kfifo_from_user()
223 len = l; in __kfifo_from_user()
225 ret = kfifo_copy_from_user(fifo, from, len, fifo->in, copied); in __kfifo_from_user()
227 len -= ret; in __kfifo_from_user()
231 fifo->in += len; in __kfifo_from_user()
237 unsigned int len, unsigned int off, unsigned int *copied) in kfifo_copy_to_user() argument
248 len *= esize; in kfifo_copy_to_user()
250 l = min(len, size - off); in kfifo_copy_to_user()
254 ret = DIV_ROUND_UP(ret + len - l, esize); in kfifo_copy_to_user()
256 ret = copy_to_user(to + l, fifo->data, len - l); in kfifo_copy_to_user()
265 *copied = len - ret * esize; in kfifo_copy_to_user()
271 unsigned long len, unsigned int *copied) in __kfifo_to_user() argument
279 len /= esize; in __kfifo_to_user()
282 if (len > l) in __kfifo_to_user()
283 len = l; in __kfifo_to_user()
284 ret = kfifo_copy_to_user(fifo, to, len, fifo->out, copied); in __kfifo_to_user()
286 len -= ret; in __kfifo_to_user()
290 fifo->out += len; in __kfifo_to_user()
296 int nents, unsigned int len) in setup_sgl_buf() argument
306 if (!len) in setup_sgl_buf()
314 while (len >= l + PAGE_SIZE - off) { in setup_sgl_buf()
326 len -= l - off; in setup_sgl_buf()
330 sg_set_page(sgl, page, len, off); in setup_sgl_buf()
335 int nents, unsigned int len, unsigned int off) in setup_sgl() argument
346 len *= esize; in setup_sgl()
348 l = min(len, size - off); in setup_sgl()
351 n += setup_sgl_buf(sgl + n, fifo->data, nents - n, len - l); in setup_sgl()
357 struct scatterlist *sgl, int nents, unsigned int len) in __kfifo_dma_in_prepare() argument
362 if (len > l) in __kfifo_dma_in_prepare()
363 len = l; in __kfifo_dma_in_prepare()
365 return setup_sgl(fifo, sgl, nents, len, fifo->in); in __kfifo_dma_in_prepare()
370 struct scatterlist *sgl, int nents, unsigned int len) in __kfifo_dma_out_prepare() argument
375 if (len > l) in __kfifo_dma_out_prepare()
376 len = l; in __kfifo_dma_out_prepare()
378 return setup_sgl(fifo, sgl, nents, len, fifo->out); in __kfifo_dma_out_prepare()
382 unsigned int __kfifo_max_r(unsigned int len, size_t recsize) in __kfifo_max_r() argument
386 if (len > max) in __kfifo_max_r()
388 return len; in __kfifo_max_r()
439 unsigned int len, size_t recsize) in __kfifo_in_r() argument
441 if (len + recsize > kfifo_unused(fifo)) in __kfifo_in_r()
444 __kfifo_poke_n(fifo, len, recsize); in __kfifo_in_r()
446 kfifo_copy_in(fifo, buf, len, fifo->in + recsize); in __kfifo_in_r()
447 fifo->in += len + recsize; in __kfifo_in_r()
448 return len; in __kfifo_in_r()
453 void *buf, unsigned int len, size_t recsize, unsigned int *n) in kfifo_out_copy_r() argument
457 if (len > *n) in kfifo_out_copy_r()
458 len = *n; in kfifo_out_copy_r()
460 kfifo_copy_out(fifo, buf, len, fifo->out + recsize); in kfifo_out_copy_r()
461 return len; in kfifo_out_copy_r()
465 unsigned int len, size_t recsize) in __kfifo_out_peek_r() argument
472 return kfifo_out_copy_r(fifo, buf, len, recsize, &n); in __kfifo_out_peek_r()
477 unsigned int len, size_t recsize) in __kfifo_out_r() argument
484 len = kfifo_out_copy_r(fifo, buf, len, recsize, &n); in __kfifo_out_r()
486 return len; in __kfifo_out_r()
500 unsigned long len, unsigned int *copied, size_t recsize) in __kfifo_from_user_r() argument
504 len = __kfifo_max_r(len, recsize); in __kfifo_from_user_r()
506 if (len + recsize > kfifo_unused(fifo)) { in __kfifo_from_user_r()
511 __kfifo_poke_n(fifo, len, recsize); in __kfifo_from_user_r()
513 ret = kfifo_copy_from_user(fifo, from, len, fifo->in + recsize, copied); in __kfifo_from_user_r()
518 fifo->in += len + recsize; in __kfifo_from_user_r()
524 unsigned long len, unsigned int *copied, size_t recsize) in __kfifo_to_user_r() argument
535 if (len > n) in __kfifo_to_user_r()
536 len = n; in __kfifo_to_user_r()
538 ret = kfifo_copy_to_user(fifo, to, len, fifo->out + recsize, copied); in __kfifo_to_user_r()
549 struct scatterlist *sgl, int nents, unsigned int len, size_t recsize) in __kfifo_dma_in_prepare_r() argument
553 len = __kfifo_max_r(len, recsize); in __kfifo_dma_in_prepare_r()
555 if (len + recsize > kfifo_unused(fifo)) in __kfifo_dma_in_prepare_r()
558 return setup_sgl(fifo, sgl, nents, len, fifo->in + recsize); in __kfifo_dma_in_prepare_r()
563 unsigned int len, size_t recsize) in __kfifo_dma_in_finish_r() argument
565 len = __kfifo_max_r(len, recsize); in __kfifo_dma_in_finish_r()
566 __kfifo_poke_n(fifo, len, recsize); in __kfifo_dma_in_finish_r()
567 fifo->in += len + recsize; in __kfifo_dma_in_finish_r()
572 struct scatterlist *sgl, int nents, unsigned int len, size_t recsize) in __kfifo_dma_out_prepare_r() argument
576 len = __kfifo_max_r(len, recsize); in __kfifo_dma_out_prepare_r()
578 if (len + recsize > fifo->in - fifo->out) in __kfifo_dma_out_prepare_r()
581 return setup_sgl(fifo, sgl, nents, len, fifo->out + recsize); in __kfifo_dma_out_prepare_r()
587 unsigned int len; in __kfifo_dma_out_finish_r() local
589 len = __kfifo_peek_n(fifo, recsize); in __kfifo_dma_out_finish_r()
590 fifo->out += len + recsize; in __kfifo_dma_out_finish_r()