Commit b3476e67 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by 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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b8c162c9
......@@ -270,24 +270,15 @@ static int usbduxsub_unlink_inurbs(struct usbdux_private *usbduxsub_tmp)
return err;
}
/*
* 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)
static int usbdux_ai_stop(struct comedi_device *dev, int do_unlink)
{
struct usbdux_private *devpriv = dev->private;
int ret = 0;
if (!this_usbduxsub)
return -EFAULT;
if (do_unlink) {
/* stop aquistion */
ret = usbduxsub_unlink_inurbs(this_usbduxsub);
}
if (do_unlink)
ret = usbduxsub_unlink_inurbs(devpriv);
this_usbduxsub->ai_cmd_running = 0;
devpriv->ai_cmd_running = 0;
return ret;
}
......@@ -310,7 +301,7 @@ static int usbdux_ai_cancel(struct comedi_device *dev,
/* prevent other CPUs from submitting new commands just now */
down(&this_usbduxsub->sem);
/* 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);
return res;
}
......@@ -346,7 +337,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb)
s->async->events |= COMEDI_CB_ERROR;
comedi_event(dev, s);
/* stop the transfer w/o unlink */
usbdux_ai_stop(devpriv, 0);
usbdux_ai_stop(dev, 0);
}
return;
......@@ -361,7 +352,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb)
s->async->events |= COMEDI_CB_ERROR;
comedi_event(dev, s);
/* don't do an unlink here */
usbdux_ai_stop(devpriv, 0);
usbdux_ai_stop(dev, 0);
}
return;
}
......@@ -392,7 +383,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb)
s->async->events |= COMEDI_CB_ERROR;
comedi_event(dev, s);
/* don't do an unlink here */
usbdux_ai_stop(devpriv, 0);
usbdux_ai_stop(dev, 0);
return;
}
......@@ -410,7 +401,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb)
/* all samples received? */
if (devpriv->ai_sample_count < 0) {
/* prevent a resubmit next time */
usbdux_ai_stop(devpriv, 0);
usbdux_ai_stop(dev, 0);
/* say comedi that the acquistion is over */
s->async->events |= COMEDI_CB_EOA;
comedi_event(dev, s);
......@@ -430,7 +421,7 @@ static void usbduxsub_ai_isoc_irq(struct urb *urb)
}
if (unlikely(err == 0)) {
/* buffer overflow */
usbdux_ai_stop(devpriv, 0);
usbdux_ai_stop(dev, 0);
return;
}
}
......
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