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

staging: comedi: comedi_test: use comedi_handle_events()

Use comedi_handle_events() to automatically (*cancel) the async command
for an end-of-acquisition or if an error/overflow occurs.

For aesthetics, add a local variable for the comedi_subdevice pointer.
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 06602191
...@@ -164,7 +164,8 @@ static void waveform_ai_interrupt(unsigned long arg) ...@@ -164,7 +164,8 @@ static void waveform_ai_interrupt(unsigned long arg)
{ {
struct comedi_device *dev = (struct comedi_device *)arg; struct comedi_device *dev = (struct comedi_device *)arg;
struct waveform_private *devpriv = dev->private; struct waveform_private *devpriv = dev->private;
struct comedi_async *async = dev->read_subdev->async; struct comedi_subdevice *s = dev->read_subdev;
struct comedi_async *async = s->async;
struct comedi_cmd *cmd = &async->cmd; struct comedi_cmd *cmd = &async->cmd;
unsigned int i, j; unsigned int i, j;
/* all times in microsec */ /* all times in microsec */
...@@ -203,7 +204,7 @@ static void waveform_ai_interrupt(unsigned long arg) ...@@ -203,7 +204,7 @@ static void waveform_ai_interrupt(unsigned long arg)
devpriv->usec_current + devpriv->usec_current +
i * devpriv->scan_period + i * devpriv->scan_period +
j * devpriv->convert_period); j * devpriv->convert_period);
cfc_write_to_buffer(dev->read_subdev, sample); cfc_write_to_buffer(s, sample);
} }
} }
...@@ -216,7 +217,7 @@ static void waveform_ai_interrupt(unsigned long arg) ...@@ -216,7 +217,7 @@ static void waveform_ai_interrupt(unsigned long arg)
else else
mod_timer(&devpriv->timer, jiffies + 1); mod_timer(&devpriv->timer, jiffies + 1);
comedi_event(dev, dev->read_subdev); comedi_handle_events(dev, s);
} }
static int waveform_ai_cmdtest(struct comedi_device *dev, static int waveform_ai_cmdtest(struct comedi_device *dev,
......
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