summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-07-24 21:18:15 (GMT)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-25 20:15:37 (GMT)
commit7c8ed94eb8c0bae49f900085d5221529cf20378c (patch)
tree51337b7f7a2bb1e3ae6163ea1a98784b446f73a5 /drivers
parentaa6081e5e0989f4df9ca35fa412e3ba8c23e38df (diff)
downloadlinux-fsl-qoriq-7c8ed94eb8c0bae49f900085d5221529cf20378c.tar.xz
staging: comedi: usbdux: tidy up usbdux_ao_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: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/comedi/drivers/usbdux.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c
index edee148..1f67509 100644
--- a/drivers/staging/comedi/drivers/usbdux.c
+++ b/drivers/staging/comedi/drivers/usbdux.c
@@ -436,20 +436,15 @@ static int usbduxsub_unlink_outurbs(struct usbdux_private *usbduxsub_tmp)
return err;
}
-/* This will cancel a running acquisition operation
- * in any context.
- */
-static int usbdux_ao_stop(struct usbdux_private *this_usbduxsub, int do_unlink)
+static int usbdux_ao_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)
- ret = usbduxsub_unlink_outurbs(this_usbduxsub);
+ ret = usbduxsub_unlink_outurbs(devpriv);
- this_usbduxsub->ao_cmd_running = 0;
+ devpriv->ao_cmd_running = 0;
return ret;
}
@@ -467,7 +462,7 @@ static int usbdux_ao_cancel(struct comedi_device *dev,
/* prevent other CPUs from submitting a command just now */
down(&this_usbduxsub->sem);
/* unlink only if it is really running */
- res = usbdux_ao_stop(this_usbduxsub, this_usbduxsub->ao_cmd_running);
+ res = usbdux_ao_stop(dev, this_usbduxsub->ao_cmd_running);
up(&this_usbduxsub->sem);
return res;
}
@@ -494,7 +489,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb)
if (devpriv->ao_cmd_running) {
s->async->events |= COMEDI_CB_EOA;
comedi_event(dev, s);
- usbdux_ao_stop(devpriv, 0);
+ usbdux_ao_stop(dev, 0);
}
return;
@@ -508,7 +503,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb)
s->async->events |= COMEDI_CB_EOA;
comedi_event(dev, s);
/* we do an unlink if we are in the high speed mode */
- usbdux_ao_stop(devpriv, 0);
+ usbdux_ao_stop(dev, 0);
}
return;
}
@@ -529,7 +524,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb)
devpriv->ao_sample_count--;
if (devpriv->ao_sample_count < 0) {
/* all samples transmitted */
- usbdux_ao_stop(devpriv, 0);
+ usbdux_ao_stop(dev, 0);
s->async->events |= COMEDI_CB_EOA;
comedi_event(dev, s);
/* no resubmit of the urb */
@@ -588,7 +583,7 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb)
s->async->events |= COMEDI_CB_ERROR;
comedi_event(dev, s);
/* don't do an unlink here */
- usbdux_ao_stop(devpriv, 0);
+ usbdux_ao_stop(dev, 0);
}
}
}