Skip to content

Commit 0ca7f61

Browse files
bigguinessgregkh
authored andcommitted
staging: comedi: comedi_buf: comedi_buf_memcpy_from() remove 'offset' param
This parameter is always passed as '0'. Remove the unnecessary parameter. This allows removing the unnecessary check of the read_ptr overflow. Signed-off-by: H Hartley Sweeten <[email protected]> Reviewed-by: Ian Abbott <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 319ad74 commit 0ca7f61

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/staging/comedi/comedi_buf.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,15 +466,11 @@ static void comedi_buf_memcpy_to(struct comedi_subdevice *s,
466466
}
467467

468468
static void comedi_buf_memcpy_from(struct comedi_subdevice *s,
469-
unsigned int offset,
470469
void *dest, unsigned int nbytes)
471470
{
472471
void *src;
473472
struct comedi_async *async = s->async;
474-
unsigned int read_ptr = async->buf_read_ptr + offset;
475-
476-
if (read_ptr >= async->prealloc_bufsz)
477-
read_ptr %= async->prealloc_bufsz;
473+
unsigned int read_ptr = async->buf_read_ptr;
478474

479475
while (nbytes) {
480476
unsigned int block_size;
@@ -557,7 +553,7 @@ unsigned int comedi_buf_read_samples(struct comedi_subdevice *s,
557553
return 0;
558554

559555
nbytes = comedi_buf_read_alloc(s, nsamples * bytes_per_sample(s));
560-
comedi_buf_memcpy_from(s, 0, data, nbytes);
556+
comedi_buf_memcpy_from(s, data, nbytes);
561557
comedi_buf_read_free(s, nbytes);
562558
comedi_inc_scan_progress(s, nbytes);
563559
s->async->events |= COMEDI_CB_BLOCK;

0 commit comments

Comments
 (0)