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

index a3c3f21e77f924fa065b6caaf20463715d9786a7..f295285d2aa6a155c2f1f911c53d3c2d38f43503 100644 (file)
@@ -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;
index 365e191228beae11726148c24bf6efdd97a73825..ada6024be6ee85820257c85d899acf1f5214bbb2 100644 (file)
@@ -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;
index c481620042ba34eb8079238a31b2fb1a74e4a68f..a5d479c1266e66c06079d0cb9c7e749a886690c5 100644 (file)
@@ -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);
 
index da4634e8cfebad86b3073f836d1c565246ef60f2..e8beeab7a78b35e5c5ccbb68cdb6aff482b57229 100644 (file)
@@ -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)
index d0740d603ae7f81d5569f38b0f1131f8d4fdacf0..d6f6a7a5bad166de975ff9b5e5eac9e35ccb56f9 100644 (file)
@@ -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)
index 0e13ac9f34736b47a21a0723a77bb0a2025dfd9b..aca1e69009a82903bfadfe507c943a73809a6274 100644 (file)
@@ -2893,7 +2893,7 @@ static unsigned int load_ao_dma_buffer(struct comedi_device *dev,
        buffer_index = devpriv->ao_dma_index;
        prev_buffer_index = prev_ao_dma_index(dev);
 
-       num_bytes = comedi_buf_read_n_available(dev->write_subdev->async);
+       num_bytes = comedi_buf_read_n_available(dev->write_subdev);
        if (num_bytes > DMA_BUFFER_SIZE)
                num_bytes = DMA_BUFFER_SIZE;
        if (cmd->stop_src == TRIG_COUNT && num_bytes > devpriv->ao_count)
index 0d4b9019f76a2b67ad6398360c71995b3388b0e4..2858b3d559c1fe1b492bb74d0f69252606d4432f 100644 (file)
@@ -825,7 +825,7 @@ static int ni_660x_input_poll(struct comedi_device *dev,
        spin_lock_irqsave(&devpriv->interrupt_lock, flags);
        mite_sync_input_dma(counter->mite_chan, s->async);
        spin_unlock_irqrestore(&devpriv->interrupt_lock, flags);
-       return comedi_buf_read_n_available(s->async);
+       return comedi_buf_read_n_available(s);
 }
 
 static int ni_660x_buf_change(struct comedi_device *dev,
index 950b223440d446a916ad0eeaeab90f20e222cafb..e54488c2eb5ad125c8dd77844710a223e8c98d34 100644 (file)
@@ -1200,7 +1200,7 @@ static int ni_ao_fifo_half_empty(struct comedi_device *dev,
        const struct ni_board_struct *board = comedi_board(dev);
        int n;
 
-       n = comedi_buf_read_n_available(s->async);
+       n = comedi_buf_read_n_available(s);
        if (n == 0) {
                s->async->events |= COMEDI_CB_OVERFLOW;
                return 0;
@@ -1230,7 +1230,7 @@ static int ni_ao_prep_fifo(struct comedi_device *dev,
                ni_ao_win_outl(dev, 0x6, AO_FIFO_Offset_Load_611x);
 
        /* load some data */
-       n = comedi_buf_read_n_available(s->async);
+       n = comedi_buf_read_n_available(s);
        if (n == 0)
                return 0;