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

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

staging: comedi: pass subdevice to comedi_buf_get()



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

The function gets a sample value from the comedi buffer, but currently
only deals with 16-bit sample types.  A future version could deal with
16 or 32-bit sample types depending on the value of the SDF_LSAMPL
subdevice flag.

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 3672effd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -431,8 +431,9 @@ int comedi_buf_put(struct comedi_subdevice *s, unsigned short x)
}
EXPORT_SYMBOL_GPL(comedi_buf_put);

int comedi_buf_get(struct comedi_async *async, unsigned short *x)
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);

	if (n < sizeof(short))
+1 −1
Original line number Diff line number Diff line
@@ -344,7 +344,7 @@ unsigned int comedi_buf_read_alloc(struct comedi_async *, unsigned int);
unsigned int comedi_buf_read_free(struct comedi_async *, unsigned int);

int comedi_buf_put(struct comedi_subdevice *s, unsigned short x);
int comedi_buf_get(struct comedi_async *, unsigned short *);
int comedi_buf_get(struct comedi_subdevice *s, unsigned short *x);

void comedi_buf_memcpy_to(struct comedi_async *async, unsigned int offset,
			  const void *source, unsigned int num_bytes);
+2 −2
Original line number Diff line number Diff line
@@ -1164,7 +1164,7 @@ static void pci230_handle_ao_nofifo(struct comedi_device *dev,
		return;
	for (i = 0; i < cmd->chanlist_len; i++) {
		/* Read sample from Comedi's circular buffer. */
		ret = comedi_buf_get(s->async, &data);
		ret = comedi_buf_get(s, &data);
		if (ret == 0) {
			s->async->events |= COMEDI_CB_OVERFLOW;
			pci230_ao_stop(dev, s);
@@ -1250,7 +1250,7 @@ static int pci230_handle_ao_fifo(struct comedi_device *dev,
			for (i = 0; i < cmd->chanlist_len; i++) {
				unsigned short datum;

				comedi_buf_get(async, &datum);
				comedi_buf_get(s, &datum);
				pci230_ao_write_fifo(dev, datum,
						     CR_CHAN(cmd->chanlist[i]));
			}
+2 −2
Original line number Diff line number Diff line
@@ -1149,7 +1149,7 @@ static void ni_ao_fifo_load(struct comedi_device *dev,

	chan = async->cur_chan;
	for (i = 0; i < n; i++) {
		err &= comedi_buf_get(async, &d);
		err &= comedi_buf_get(s, &d);
		if (err == 0)
			break;

@@ -1159,7 +1159,7 @@ static void ni_ao_fifo_load(struct comedi_device *dev,
			packed_data = d & 0xffff;
			/* 6711 only has 16 bit wide ao fifo */
			if (board->reg_type != ni_reg_6711) {
				err &= comedi_buf_get(async, &d);
				err &= comedi_buf_get(s, &d);
				if (err == 0)
					break;
				chan++;
+1 −1
Original line number Diff line number Diff line
@@ -484,7 +484,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb)
			unsigned int chan = devpriv->ao_chanlist[i];
			unsigned short val;

			ret = comedi_buf_get(s->async, &val);
			ret = comedi_buf_get(s, &val);
			if (ret < 0) {
				dev_err(dev->class_dev, "buffer underflow\n");
				s->async->events |= (COMEDI_CB_EOA |
Loading