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

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

staging: comedi: pass subdevice to comedi_buf_read_n_available()



Change the parameters of `comedi_buf_read_n_available()` 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 f1df8662
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -350,8 +350,9 @@ unsigned int comedi_buf_write_free(struct comedi_subdevice *s,
}
EXPORT_SYMBOL_GPL(comedi_buf_write_free);

unsigned int comedi_buf_read_n_available(struct comedi_async *async)
unsigned int comedi_buf_read_n_available(struct comedi_subdevice *s)
{
	struct comedi_async *async = s->async;
	unsigned num_bytes;

	if (!async)
@@ -439,7 +440,7 @@ EXPORT_SYMBOL_GPL(comedi_buf_put);
int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x)
{
	struct comedi_async *async = s->async;
	unsigned int n = comedi_buf_read_n_available(async);
	unsigned int n = comedi_buf_read_n_available(s);

	if (n < sizeof(short))
		return 0;
+2 −2
Original line number Diff line number Diff line
@@ -2029,7 +2029,7 @@ static unsigned int comedi_poll(struct file *file, poll_table *wait)
	if (s && s->async) {
		poll_wait(file, &s->async->wait_head, wait);
		if (!s->busy || !comedi_is_subdevice_running(s) ||
		    comedi_buf_read_n_available(s->async) > 0)
		    comedi_buf_read_n_available(s) > 0)
			mask |= POLLIN | POLLRDNORM;
	}

@@ -2229,7 +2229,7 @@ static ssize_t comedi_read(struct file *file, char __user *buf, size_t nbytes,

		n = nbytes;

		m = comedi_buf_read_n_available(async);
		m = comedi_buf_read_n_available(s);
		/* printk("%d available\n",m); */
		if (async->buf_read_ptr + m > async->prealloc_bufsz)
			m = async->prealloc_bufsz - async->buf_read_ptr;
+1 −1
Original line number Diff line number Diff line
@@ -339,7 +339,7 @@ int comedi_set_hw_dev(struct comedi_device *dev, struct device *hw_dev);
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_n_available(struct comedi_subdevice *s);
unsigned int comedi_buf_read_alloc(struct comedi_subdevice *s, unsigned int n);
unsigned int comedi_buf_read_free(struct comedi_subdevice *s, unsigned int n);

+1 −1
Original line number Diff line number Diff line
@@ -558,7 +558,7 @@ static void pci224_ao_handle_fifo(struct comedi_device *dev,
		bytes_per_scan = sizeof(short);
	}
	/* Determine number of scans available in buffer. */
	num_scans = comedi_buf_read_n_available(s->async) / bytes_per_scan;
	num_scans = comedi_buf_read_n_available(s) / bytes_per_scan;
	if (cmd->stop_src == TRIG_COUNT) {
		/* Fixed number of scans. */
		if (num_scans > devpriv->ao_stop_count)
+1 −1
Original line number Diff line number Diff line
@@ -1205,7 +1205,7 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev,
	dacstat = inw(dev->iobase + PCI230_DACCON);
	/* Determine number of scans available in buffer. */
	bytes_per_scan = cmd->chanlist_len * sizeof(short);
	num_scans = comedi_buf_read_n_available(async) / bytes_per_scan;
	num_scans = comedi_buf_read_n_available(s) / bytes_per_scan;
	if (cmd->stop_src == TRIG_COUNT) {
		/* Fixed number of scans. */
		if (num_scans > devpriv->ao_scan_count)
Loading