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

staging: comedi: pcmmio: tidy up pcmmio_handle_dio_intr()

Refactor the code to remove some of the indent levels.

Remove 'mytrig', the shift and mask end up making it the same as 'triggered'
anyway.
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 967e7e5a
...@@ -359,25 +359,27 @@ static void pcmmio_handle_dio_intr(struct comedi_device *dev, ...@@ -359,25 +359,27 @@ static void pcmmio_handle_dio_intr(struct comedi_device *dev,
unsigned int triggered) unsigned int triggered)
{ {
struct pcmmio_private *devpriv = dev->private; struct pcmmio_private *devpriv = dev->private;
unsigned int oldevents = s->async->events;
unsigned int len = s->async->cmd.chanlist_len;
unsigned int val = 0;
unsigned long flags; unsigned long flags;
unsigned oldevents; int i;
spin_lock_irqsave(&devpriv->spinlock, flags); spin_lock_irqsave(&devpriv->spinlock, flags);
oldevents = s->async->events; if (!devpriv->active)
goto done;
if (devpriv->active) { if (!(triggered & devpriv->enabled_mask))
unsigned mytrig = ((triggered >> 0) & ((1 << 24) - 1)) << 0; goto done;
if (mytrig & devpriv->enabled_mask) {
unsigned int val = 0; for (i = 0; i < len; i++) {
unsigned int n, ch, len; unsigned int chan = CR_CHAN(s->async->cmd.chanlist[i]);
len = s->async->cmd.chanlist_len; if (triggered & (1 << chan))
for (n = 0; n < len; n++) { val |= (1 << i);
ch = CR_CHAN(s->async->cmd.chanlist[n]);
if (mytrig & (1U << ch))
val |= (1U << n);
} }
/* Write the scan to the buffer. */ /* Write the scan to the buffer. */
if (comedi_buf_put(s->async, val) && if (comedi_buf_put(s->async, val) &&
comedi_buf_put (s->async, val >> 16)) { comedi_buf_put (s->async, val >> 16)) {
...@@ -400,9 +402,8 @@ static void pcmmio_handle_dio_intr(struct comedi_device *dev, ...@@ -400,9 +402,8 @@ static void pcmmio_handle_dio_intr(struct comedi_device *dev,
} }
} }
} }
}
}
done:
spin_unlock_irqrestore(&devpriv->spinlock, flags); spin_unlock_irqrestore(&devpriv->spinlock, flags);
if (oldevents != s->async->events) if (oldevents != s->async->events)
......
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