staging: comedi: pcl818: remove 'ai_n_chan' from private data
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Mon, 17 Feb 2014 21:27:25 +0000 (14:27 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 18 Feb 2014 19:55:31 +0000 (11:55 -0800)
This member of the private data is just a copy of the cmd->chanlist_len.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/pcl818.c

index eea48ded04138ed2c8c628ba1a7b651c3f80f915..f73fc791a13c1dbc503a2c32140c41d3e7cde55e 100644 (file)
@@ -341,7 +341,6 @@ struct pcl818_private {
        unsigned int act_chanlist[16];  /*  MUX setting for actual AI operations */
        unsigned int act_chanlist_len;  /*  how long is actual MUX list */
        unsigned int act_chanlist_pos;  /*  actual position in MUX list */
-       unsigned int ai_n_chan; /*  how many channels is measured */
        unsigned int *ai_chanlist;      /*  actaul chanlist */
        unsigned int ai_flags;  /*  flaglist */
        unsigned int ai_data_len;       /*  len of data buffer */
@@ -515,6 +514,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_int(int irq, void *d)
        struct comedi_device *dev = d;
        struct pcl818_private *devpriv = dev->private;
        struct comedi_subdevice *s = dev->read_subdev;
+       struct comedi_cmd *cmd = &s->async->cmd;
        unsigned int chan;
        int timeout = 50;       /* wait max 50us */
 
@@ -549,7 +549,7 @@ conv_finish:
                devpriv->act_chanlist_pos = 0;
 
        s->async->cur_chan++;
-       if (s->async->cur_chan >= devpriv->ai_n_chan) {
+       if (s->async->cur_chan >= cmd->chanlist_len) {
                s->async->cur_chan = 0;
                devpriv->ai_act_scan--;
        }
@@ -573,6 +573,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d)
        struct comedi_device *dev = d;
        struct pcl818_private *devpriv = dev->private;
        struct comedi_subdevice *s = dev->read_subdev;
+       struct comedi_cmd *cmd = &s->async->cmd;
        int i, len, bufptr;
        unsigned long flags;
        unsigned short *ptr;
@@ -622,7 +623,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_dma(int irq, void *d)
                        devpriv->act_chanlist_pos = 0;
 
                s->async->cur_chan++;
-               if (s->async->cur_chan >= devpriv->ai_n_chan) {
+               if (s->async->cur_chan >= cmd->chanlist_len) {
                        s->async->cur_chan = 0;
                        devpriv->ai_act_scan--;
                }
@@ -650,6 +651,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d)
        struct comedi_device *dev = d;
        struct pcl818_private *devpriv = dev->private;
        struct comedi_subdevice *s = dev->read_subdev;
+       struct comedi_cmd *cmd = &s->async->cmd;
        int i, len;
        unsigned char lo;
 
@@ -698,7 +700,7 @@ static irqreturn_t interrupt_pcl818_ai_mode13_fifo(int irq, void *d)
                        devpriv->act_chanlist_pos = 0;
 
                s->async->cur_chan++;
-               if (s->async->cur_chan >= devpriv->ai_n_chan) {
+               if (s->async->cur_chan >= cmd->chanlist_len) {
                        s->async->cur_chan = 0;
                        devpriv->ai_act_scan--;
                }
@@ -796,7 +798,7 @@ static void pcl818_ai_mode13dma_int(int mode, struct comedi_device *dev,
        disable_dma(devpriv->dma);      /*  disable dma */
        bytes = devpriv->hwdmasize[0];
        if (!devpriv->neverending_ai) {
-               bytes = devpriv->ai_n_chan * cmd->stop_arg * sizeof(short);     /*  how many */
+               bytes = cmd->chanlist_len * cmd->stop_arg * sizeof(short);      /*  how many */
                devpriv->dma_runs_to_end = bytes / devpriv->hwdmasize[0];       /*  how many DMA pages we must fiil */
                devpriv->last_dma_run = bytes % devpriv->hwdmasize[0];  /* on last dma transfer must be moved */
                devpriv->dma_runs_to_end--;
@@ -840,11 +842,11 @@ static int pcl818_ai_cmd_mode(int mode, struct comedi_device *dev,
        start_pacer(dev, -1, 0, 0);     /*  stop pacer */
 
        seglen = check_channel_list(dev, s, devpriv->ai_chanlist,
-                                   devpriv->ai_n_chan);
+                                   cmd->chanlist_len);
        if (seglen < 1)
                return -EINVAL;
        setup_channel_list(dev, s, devpriv->ai_chanlist,
-                          devpriv->ai_n_chan, seglen);
+                          cmd->chanlist_len, seglen);
 
        udelay(1);
 
@@ -1115,7 +1117,6 @@ static int ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
        struct comedi_cmd *cmd = &s->async->cmd;
        int retval;
 
-       devpriv->ai_n_chan = cmd->chanlist_len;
        devpriv->ai_chanlist = cmd->chanlist;
        devpriv->ai_flags = cmd->flags;
        devpriv->ai_data_len = s->async->prealloc_bufsz;