mirror of https://gitee.com/openkylin/linux.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 <abbotti@mev.co.uk> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3672effdea
commit
458c13e935
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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]));
|
||||
}
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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 |
|
||||
|
|
|
@ -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 |
|
||||
|
|
Loading…
Reference in New Issue