Commit 56e78120 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: addi_apci_2032: tidy up cmd use in apci2032_interrupt()

Use a local variable for the comedi_cmd and tidy up this function a bit.
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 f1c51faa
...@@ -197,6 +197,7 @@ static irqreturn_t apci2032_interrupt(int irq, void *d) ...@@ -197,6 +197,7 @@ static irqreturn_t apci2032_interrupt(int irq, void *d)
{ {
struct comedi_device *dev = d; struct comedi_device *dev = d;
struct comedi_subdevice *s = dev->read_subdev; struct comedi_subdevice *s = dev->read_subdev;
struct comedi_cmd *cmd = &s->async->cmd;
struct apci2032_int_private *subpriv; struct apci2032_int_private *subpriv;
unsigned int val; unsigned int val;
bool do_event = false; bool do_event = false;
...@@ -222,21 +223,20 @@ static irqreturn_t apci2032_interrupt(int irq, void *d) ...@@ -222,21 +223,20 @@ static irqreturn_t apci2032_interrupt(int irq, void *d)
*/ */
if (subpriv->active && (val & subpriv->enabled_isns) != 0) { if (subpriv->active && (val & subpriv->enabled_isns) != 0) {
unsigned short bits; unsigned short bits = 0;
unsigned int n, len; int i;
unsigned int *chanlist;
/* Bits in scan data correspond to indices in channel list. */ /* Bits in scan data correspond to indices in channel list. */
bits = 0; for (i = 0; i < cmd->chanlist_len; i++) {
len = s->async->cmd.chanlist_len; unsigned int chan = CR_CHAN(cmd->chanlist[i]);
chanlist = &s->async->cmd.chanlist[0];
for (n = 0; n < len; n++) if (val & (1 << chan))
if ((val & (1U << CR_CHAN(chanlist[n]))) != 0) bits |= (1 << i);
bits |= 1U << n; }
if (comedi_buf_put(s->async, bits)) { if (comedi_buf_put(s->async, bits)) {
s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; s->async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS;
if (s->async->cmd.stop_src == TRIG_COUNT && if (cmd->stop_src == TRIG_COUNT &&
subpriv->stop_count > 0) { subpriv->stop_count > 0) {
subpriv->stop_count--; subpriv->stop_count--;
if (subpriv->stop_count == 0) { if (subpriv->stop_count == 0) {
......
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