diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2014-04-29 12:59:36 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-03 20:06:32 -0400 |
commit | 56e781203f055e93e2ff510d87a986e2b367c071 (patch) | |
tree | 5f793db1a04c0341c099f4bd9a7afed03e4ac0ac | |
parent | f1c51faabc4d974cd118603e237aa5381437e634 (diff) | |
download | linux-rt-56e781203f055e93e2ff510d87a986e2b367c071.tar.gz |
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: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/addi_apci_2032.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/staging/comedi/drivers/addi_apci_2032.c b/drivers/staging/comedi/drivers/addi_apci_2032.c index feefc7a5ca9a..2fd14553e57c 100644 --- a/drivers/staging/comedi/drivers/addi_apci_2032.c +++ b/drivers/staging/comedi/drivers/addi_apci_2032.c @@ -197,6 +197,7 @@ static irqreturn_t apci2032_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct comedi_subdevice *s = dev->read_subdev; + struct comedi_cmd *cmd = &s->async->cmd; struct apci2032_int_private *subpriv; unsigned int val; bool do_event = false; @@ -222,21 +223,20 @@ static irqreturn_t apci2032_interrupt(int irq, void *d) */ if (subpriv->active && (val & subpriv->enabled_isns) != 0) { - unsigned short bits; - unsigned int n, len; - unsigned int *chanlist; + unsigned short bits = 0; + int i; /* Bits in scan data correspond to indices in channel list. */ - bits = 0; - len = s->async->cmd.chanlist_len; - chanlist = &s->async->cmd.chanlist[0]; - for (n = 0; n < len; n++) - if ((val & (1U << CR_CHAN(chanlist[n]))) != 0) - bits |= 1U << n; + for (i = 0; i < cmd->chanlist_len; i++) { + unsigned int chan = CR_CHAN(cmd->chanlist[i]); + + if (val & (1 << chan)) + bits |= (1 << i); + } if (comedi_buf_put(s->async, bits)) { 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--; if (subpriv->stop_count == 0) { |