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

Commit d13be55a authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman
Browse files

staging: comedi: pass subdevice to comedi_buf_read_alloc()



Change the parameters of `comedi_buf_read_alloc()` to pass a pointer to
the comedi subdevice instead of a pointer to the "async" structure
belonging to the subdevice.

The main aim at the moment is to replace all the `struct comedi_async *`
parameters with `struct comedi_subdevice *` parameters in the comedi
driver API.

Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Reviewed-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0f1f34e8
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -370,9 +370,10 @@ unsigned int comedi_buf_read_n_available(struct comedi_async *async)
EXPORT_SYMBOL_GPL(comedi_buf_read_n_available);

/* allocates a chunk for the reader from filled (and munged) buffer space */
unsigned int comedi_buf_read_alloc(struct comedi_async *async,
unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s,
				   unsigned int nbytes)
{
	struct comedi_async *async = s->async;
	unsigned int available;

	available = async->munge_count - async->buf_read_alloc_count;
@@ -441,7 +442,7 @@ int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x)

	if (n < sizeof(short))
		return 0;
	comedi_buf_read_alloc(async, sizeof(short));
	comedi_buf_read_alloc(s, sizeof(short));
	*x = *(unsigned short *)(async->prealloc_buf + async->buf_read_ptr);
	comedi_buf_read_free(async, sizeof(short));
	return 1;
+2 −2
Original line number Diff line number Diff line
@@ -993,7 +993,7 @@ static int do_bufinfo_ioctl(struct comedi_device *dev,
		return -EACCES;

	if (bi.bytes_read && (s->subdev_flags & SDF_CMD_READ)) {
		bi.bytes_read = comedi_buf_read_alloc(async, bi.bytes_read);
		bi.bytes_read = comedi_buf_read_alloc(s, bi.bytes_read);
		comedi_buf_read_free(async, bi.bytes_read);

		if (comedi_is_subdevice_idle(s) &&
@@ -2272,7 +2272,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,
			retval = -EFAULT;
		}

		comedi_buf_read_alloc(async, n);
		comedi_buf_read_alloc(s, n);
		comedi_buf_read_free(async, n);

		count += n;
+1 −1
Original line number Diff line number Diff line
@@ -340,7 +340,7 @@ unsigned int comedi_buf_write_alloc(struct comedi_subdevice *s, unsigned int n);
unsigned int comedi_buf_write_free(struct comedi_subdevice *s, unsigned int n);

unsigned int comedi_buf_read_n_available(struct comedi_async *);
unsigned int comedi_buf_read_alloc(struct comedi_async *, unsigned int);
unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s, unsigned int n);
unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int);

int comedi_buf_put(struct comedi_subdevice *s, unsigned short x);
+1 −1
Original line number Diff line number Diff line
@@ -91,7 +91,7 @@ unsigned int cfc_read_array_from_buffer(struct comedi_subdevice *s,
	if (num_bytes == 0)
		return 0;

	num_bytes = comedi_buf_read_alloc(async, num_bytes);
	num_bytes = comedi_buf_read_alloc(s, num_bytes);
	comedi_buf_memcpy_from(s, 0, data, num_bytes);
	comedi_buf_read_free(async, num_bytes);
	cfc_inc_scan_progress(s, num_bytes);
+3 −3
Original line number Diff line number Diff line
@@ -560,15 +560,15 @@ EXPORT_SYMBOL_GPL(mite_sync_input_dma);
int mite_sync_output_dma(struct mite_channel *mite_chan,
			 struct comedi_async *async)
{
	struct comedi_subdevice *s = async->subdevice;
	int count;
	u32 nbytes_ub, nbytes_lb;
	unsigned int old_alloc_count;
	u32 stop_count =
	    async->cmd.stop_arg * cfc_bytes_per_scan(async->subdevice);
	u32 stop_count = async->cmd.stop_arg * cfc_bytes_per_scan(s);

	old_alloc_count = async->buf_read_alloc_count;
	/*  read alloc as much as we can */
	comedi_buf_read_alloc(async, async->prealloc_bufsz);
	comedi_buf_read_alloc(s, async->prealloc_bufsz);
	nbytes_lb = mite_bytes_read_from_memory_lb(mite_chan);
	if (async->cmd.stop_src == TRIG_COUNT &&
	    (int)(nbytes_lb - stop_count) > 0)
Loading