]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: pass subdevice to comedi_buf_get()
authorIan Abbott <abbotti@mev.co.uk>
Tue, 6 May 2014 12:12:00 +0000 (13:12 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 May 2014 12:25:47 +0000 (21:25 +0900)
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>
drivers/staging/comedi/comedi_buf.c
drivers/staging/comedi/comedidev.h
drivers/staging/comedi/drivers/amplc_pci230.c
drivers/staging/comedi/drivers/ni_mio_common.c
drivers/staging/comedi/drivers/usbdux.c
drivers/staging/comedi/drivers/usbduxsigma.c

index f127bf9bd421f61585f6585b7a82bc9c9cabdc2a..acb042c3e03469a6f1963bc81ecd464440ce37e7 100644 (file)
@@ -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))
index a874c1c43a322643a788884969fbf475e6066237..d19a20ca91b705962bc899a126f555ea5b8a30bd 100644 (file)
@@ -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);
index 9541e240925ef771143dd9aec42ad143b2403dbf..d0740d603ae7f81d5569f38b0f1131f8d4fdacf0 100644 (file)
@@ -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]));
                        }
index 087b533625df72af99634af14ac606b4c3e74170..d4e99af6de717275630b5212500b7c77ea05baf3 100644 (file)
@@ -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++;
index 011fede33a001a23dcc6e0f00aec6281b32ac335..143f6320262137aac4d8a0d15e89f4c3f51e3cdb 100644 (file)
@@ -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 |
index b57c974e5cb673e454b510169ffddd3a194e429f..52b8b8fb9ee4308abb900c0d02ed03109e1dc2e9 100644 (file)
@@ -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 |