diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-07-25 23:07:04 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-07-26 22:09:56 (GMT) |
commit | 38f0683502a5c57dd39e4c65ec86cbe8e3975d5b (patch) | |
tree | df863e0460eb913805f98cb3fe6e2793a2814a48 | |
parent | f2929618d376075e01136326148e7028350c7c38 (diff) | |
download | linux-fsl-qoriq-38f0683502a5c57dd39e4c65ec86cbe8e3975d5b.tar.xz |
staging: comedi: usbdux: tidy up usbdux_pwm_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>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/usbdux.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 82624a2..61e9df9 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -1417,20 +1417,15 @@ static int usbduxsub_unlink_pwm_urbs(struct usbdux_private *usbduxsub_tmp) return err; } -/* This cancels a running acquisition operation - * in any context. - */ -static int usbdux_pwm_stop(struct usbdux_private *this_usbduxsub, int do_unlink) +static int usbdux_pwm_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_pwm_urbs(this_usbduxsub); + ret = usbduxsub_unlink_pwm_urbs(devpriv); - this_usbduxsub->pwm_cmd_running = 0; + devpriv->pwm_cmd_running = 0; return ret; } @@ -1443,7 +1438,7 @@ static int usbdux_pwm_cancel(struct comedi_device *dev, int res = 0; /* unlink only if it is really running */ - res = usbdux_pwm_stop(this_usbduxsub, this_usbduxsub->pwm_cmd_running); + res = usbdux_pwm_stop(dev, this_usbduxsub->pwm_cmd_running); return send_dux_commands(dev, SENDPWMOFF); } @@ -1468,7 +1463,7 @@ static void usbduxsub_pwm_irq(struct urb *urb) * no unlink needed here. Already shutting down. */ if (devpriv->pwm_cmd_running) - usbdux_pwm_stop(devpriv, 0); + usbdux_pwm_stop(dev, 0); return; @@ -1478,7 +1473,7 @@ static void usbduxsub_pwm_irq(struct urb *urb) dev_err(dev->class_dev, "Non-zero urb status received in pwm intr context: %d\n", urb->status); - usbdux_pwm_stop(devpriv, 0); + usbdux_pwm_stop(dev, 0); } return; } @@ -1501,7 +1496,7 @@ static void usbduxsub_pwm_irq(struct urb *urb) "buggy USB host controller or bug in IRQ handling!\n"); /* don't do an unlink here */ - usbdux_pwm_stop(devpriv, 0); + usbdux_pwm_stop(dev, 0); } } } |