From: Ian Abbott Date: Tue, 6 May 2014 12:12:00 +0000 (+0100) Subject: staging: comedi: pass subdevice to comedi_buf_get() X-Git-Tag: v4.14-rc1~7083^2~39^2~474 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=458c13e935d9f33fffb099e49ecb53c67ddd1a21;p=platform%2Fkernel%2Flinux-rpi.git 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: Ian Abbott Reviewed-by: H Hartley Sweeten Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/comedi_buf.c b/drivers/staging/comedi/comedi_buf.c index f127bf9..acb042c 100644 --- a/drivers/staging/comedi/comedi_buf.c +++ b/drivers/staging/comedi/comedi_buf.c @@ -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)) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index a874c1c..d19a20c 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -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); diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 9541e24..d0740d6 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -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])); } diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 087b533..d4e99af 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -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++; diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 011fede..143f632 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -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 | diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index b57c974..52b8b8f 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -423,7 +423,7 @@ static void usbduxsigma_ao_urb_complete(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 |