提交 b3476e67 编写于 作者: H H Hartley Sweeten 提交者: Greg Kroah-Hartman

staging: comedi: usbdux: tidy up usbdux_ai_stop()

For aesthetic reasons, pass the comedi_device pointer to this function
instead of the private data pointer. Rename the local variable used
for the private data pointer to the comedi "norm".

Remove the unnecessary sanity check of the private data pointer. This
function can only be called is the private data was allocated during
the attach.
Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 b8c162c9
...@@ -270,24 +270,15 @@ static int usbduxsub_unlink_inurbs(struct usbdux_private *usbduxsub_tmp) ...@@ -270,24 +270,15 @@ static int usbduxsub_unlink_inurbs(struct usbdux_private *usbduxsub_tmp)
return err; return err;
} }
/* static int usbdux_ai_stop(struct comedi_device *dev, int do_unlink)
* This will stop a running acquisition operation
* Is called from within this driver from both the
* interrupt context and from comedi
*/
static int usbdux_ai_stop(struct usbdux_private *this_usbduxsub, int do_unlink)
{ {
struct usbdux_private *devpriv = dev->private;
int ret = 0; int ret = 0;
if (!this_usbduxsub) if (do_unlink)
return -EFAULT; ret = usbduxsub_unlink_inurbs(devpriv);
if (do_unlink) {
/* stop aquistion */
ret = usbduxsub_unlink_inurbs(this_usbduxsub);
}
this_usbduxsub->ai_cmd_running = 0; devpriv->ai_cmd_running = 0;
return ret; return ret;
} }
...@@ -310,7 +301,7 @@ static int usbdux_ai_cancel(struct comedi_device *dev, ...@@ -310,7 +301,7 @@ static int usbdux_ai_cancel(struct comedi_device *dev,
/* prevent other CPUs from submitting new commands just now */ /* prevent other CPUs from submitting new commands just now */
down(&this_usbduxsub->sem); down(&this_usbduxsub->sem);
/* unlink only if the urb really has been submitted */ /* unlink only if the urb really has been submitted */
res = usbdux_ai_stop(this_usbduxsub, this_usbduxsub->ai_cmd_running); res = usbdux_ai_stop(dev, this_usbduxsub->ai_cmd_running);
up(&this_usbduxsub->sem); up(&this_usbduxsub->sem);
return res; return res;
} }
...@@ -346,7 +337,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb) ...@@ -346,7 +337,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb)
s->async->events |= COMEDI_CB_ERROR; s->async->events |= COMEDI_CB_ERROR;
comedi_event(dev, s); comedi_event(dev, s);
/* stop the transfer w/o unlink */ /* stop the transfer w/o unlink */
usbdux_ai_stop(devpriv, 0); usbdux_ai_stop(dev, 0);
} }
return; return;
...@@ -361,7 +352,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb) ...@@ -361,7 +352,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb)
s->async->events |= COMEDI_CB_ERROR; s->async->events |= COMEDI_CB_ERROR;
comedi_event(dev, s); comedi_event(dev, s);
/* don't do an unlink here */ /* don't do an unlink here */
usbdux_ai_stop(devpriv, 0); usbdux_ai_stop(dev, 0);
} }
return; return;
} }
...@@ -392,7 +383,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb) ...@@ -392,7 +383,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb)
s->async->events |= COMEDI_CB_ERROR; s->async->events |= COMEDI_CB_ERROR;
comedi_event(dev, s); comedi_event(dev, s);
/* don't do an unlink here */ /* don't do an unlink here */
usbdux_ai_stop(devpriv, 0); usbdux_ai_stop(dev, 0);
return; return;
} }
...@@ -410,7 +401,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb) ...@@ -410,7 +401,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb)
/* all samples received? */ /* all samples received? */
if (devpriv->ai_sample_count < 0) { if (devpriv->ai_sample_count < 0) {
/* prevent a resubmit next time */ /* prevent a resubmit next time */
usbdux_ai_stop(devpriv, 0); usbdux_ai_stop(dev, 0);
/* say comedi that the acquistion is over */ /* say comedi that the acquistion is over */
s->async->events |= COMEDI_CB_EOA; s->async->events |= COMEDI_CB_EOA;
comedi_event(dev, s); comedi_event(dev, s);
...@@ -430,7 +421,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb) ...@@ -430,7 +421,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb)
} }
if (unlikely(err == 0)) { if (unlikely(err == 0)) {
/* buffer overflow */ /* buffer overflow */
usbdux_ai_stop(devpriv, 0); usbdux_ai_stop(dev, 0);
return; return;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册