Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ca7f61c authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 319ad742
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -466,15 +466,11 @@ static void comedi_buf_memcpy_to(struct comedi_subdevice *s,
}

static void comedi_buf_memcpy_from(struct comedi_subdevice *s,
				   unsigned int offset,
				   void *dest, unsigned int nbytes)
{
	void *src;
	struct comedi_async *async = s->async;
	unsigned int read_ptr = async->buf_read_ptr + offset;

	if (read_ptr >= async->prealloc_bufsz)
		read_ptr %= async->prealloc_bufsz;
	unsigned int read_ptr = async->buf_read_ptr;

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

	nbytes = comedi_buf_read_alloc(s, nsamples * bytes_per_sample(s));
	comedi_buf_memcpy_from(s, 0, data, nbytes);
	comedi_buf_memcpy_from(s, data, nbytes);
	comedi_buf_read_free(s, nbytes);
	comedi_inc_scan_progress(s, nbytes);
	s->async->events |= COMEDI_CB_BLOCK;