Commit 68d7808f authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: pcl816: remove 'ai_neverending' from private data

This member of the private data is not needed. We can check the stop_src
to determine this information:

  ai_neverending -> cmd->stop_src == TRIG_NONE
  !ai_neverending -> cmd->stop_src == TRIG_COUNT
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent be40b46d
...@@ -124,7 +124,6 @@ struct pcl816_private { ...@@ -124,7 +124,6 @@ struct pcl816_private {
unsigned int divisor2; unsigned int divisor2;
unsigned int ai_cmd_running:1; unsigned int ai_cmd_running:1;
unsigned int irq_was_now_closed:1; unsigned int irq_was_now_closed:1;
unsigned int ai_neverending:1;
}; };
static int check_channel_list(struct comedi_device *dev, static int check_channel_list(struct comedi_device *dev,
...@@ -247,13 +246,12 @@ static irqreturn_t interrupt_pcl816_ai_mode13_int(int irq, void *d) ...@@ -247,13 +246,12 @@ static irqreturn_t interrupt_pcl816_ai_mode13_int(int irq, void *d)
devpriv->ai_act_scan++; devpriv->ai_act_scan++;
} }
if (!devpriv->ai_neverending) if (cmd->stop_src == TRIG_COUNT &&
/* all data sampled */ devpriv->ai_act_scan >= cmd->stop_arg) {
if (devpriv->ai_act_scan >= cmd->stop_arg) { /* all data sampled */
/* all data sampled */ s->cancel(dev, s);
s->cancel(dev, s); s->async->events |= COMEDI_CB_EOA;
s->async->events |= COMEDI_CB_EOA; }
}
comedi_event(dev, s); comedi_event(dev, s);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -279,14 +277,14 @@ static void transfer_from_dma_buf(struct comedi_device *dev, ...@@ -279,14 +277,14 @@ static void transfer_from_dma_buf(struct comedi_device *dev,
devpriv->ai_act_scan++; devpriv->ai_act_scan++;
} }
if (!devpriv->ai_neverending) if (cmd->stop_src == TRIG_COUNT &&
/* all data sampled */ devpriv->ai_act_scan >= cmd->stop_arg) {
if (devpriv->ai_act_scan >= cmd->stop_arg) { /* all data sampled */
s->cancel(dev, s); s->cancel(dev, s);
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
s->async->events |= COMEDI_CB_BLOCK; s->async->events |= COMEDI_CB_BLOCK;
break; break;
} }
} }
comedi_event(dev, s); comedi_event(dev, s);
...@@ -297,6 +295,7 @@ static irqreturn_t interrupt_pcl816_ai_mode13_dma(int irq, void *d) ...@@ -297,6 +295,7 @@ static irqreturn_t interrupt_pcl816_ai_mode13_dma(int irq, void *d)
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct pcl816_private *devpriv = dev->private; struct pcl816_private *devpriv = dev->private;
struct comedi_subdevice *s = dev->read_subdev; struct comedi_subdevice *s = dev->read_subdev;
struct comedi_cmd *cmd = &s->async->cmd;
int len, bufptr, this_dma_buf; int len, bufptr, this_dma_buf;
unsigned long dma_flags; unsigned long dma_flags;
unsigned short *ptr; unsigned short *ptr;
...@@ -304,9 +303,8 @@ static irqreturn_t interrupt_pcl816_ai_mode13_dma(int irq, void *d) ...@@ -304,9 +303,8 @@ static irqreturn_t interrupt_pcl816_ai_mode13_dma(int irq, void *d)
disable_dma(devpriv->dma); disable_dma(devpriv->dma);
this_dma_buf = devpriv->next_dma_buf; this_dma_buf = devpriv->next_dma_buf;
/* switch dma bufs */ if (devpriv->dma_runs_to_end > -1 || cmd->stop_src == TRIG_NONE) {
if ((devpriv->dma_runs_to_end > -1) || devpriv->ai_neverending) { /* switch dma bufs */
devpriv->next_dma_buf = 1 - devpriv->next_dma_buf; devpriv->next_dma_buf = 1 - devpriv->next_dma_buf;
set_dma_mode(devpriv->dma, DMA_MODE_READ); set_dma_mode(devpriv->dma, DMA_MODE_READ);
dma_flags = claim_dma_lock(); dma_flags = claim_dma_lock();
...@@ -469,14 +467,9 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) ...@@ -469,14 +467,9 @@ static int pcl816_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
devpriv->ai_poll_ptr = 0; devpriv->ai_poll_ptr = 0;
devpriv->irq_was_now_closed = 0; devpriv->irq_was_now_closed = 0;
if (cmd->stop_src == TRIG_COUNT)
devpriv->ai_neverending = 0;
else
devpriv->ai_neverending = 1;
if (devpriv->dma) { if (devpriv->dma) {
bytes = devpriv->hwdmasize; bytes = devpriv->hwdmasize;
if (!devpriv->ai_neverending) { if (cmd->stop_src == TRIG_COUNT) {
/* how many */ /* how many */
bytes = s->async->cmd.chanlist_len * bytes = s->async->cmd.chanlist_len *
s->async->cmd.chanlist_len * s->async->cmd.chanlist_len *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment