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

staging: comedi: usbduxsigma: cleanup the (*cancel) functions

The (*cancel) functions can only be called by the comedi core it the
(*auto_attach) completed successfully. That function sets the comedi_device
'private' variable before initializing the callbacks so the sanity checks
are unnecessary. Remove them.

Also, rename the 'this_usbduxsub' local variable to 'devpriv' as this is
more common in comedi drivers.

Remove the unnecessary comments.
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 00fbd285
......@@ -270,25 +270,15 @@ static void usbdux_ai_stop(struct usbduxsub *devpriv, int do_unlink)
devpriv->ai_cmd_running = 0;
}
/*
* This will cancel a running acquisition operation.
* This is called by comedi but never from inside the driver.
*/
static int usbdux_ai_cancel(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct usbduxsub *this_usbduxsub;
/* force unlink of all urbs */
this_usbduxsub = dev->private;
if (!this_usbduxsub)
return -EFAULT;
struct usbduxsub *devpriv = dev->private;
/* prevent other CPUs from submitting new commands just now */
down(&this_usbduxsub->sem);
/* unlink only if the urb really has been submitted */
usbdux_ai_stop(this_usbduxsub, this_usbduxsub->ai_cmd_running);
up(&this_usbduxsub->sem);
down(&devpriv->sem);
/* unlink only if it is really running */
usbdux_ai_stop(devpriv, devpriv->ai_cmd_running);
up(&devpriv->sem);
return 0;
}
......@@ -456,20 +446,15 @@ static void usbdux_ao_stop(struct usbduxsub *devpriv, int do_unlink)
devpriv->ao_cmd_running = 0;
}
/* force unlink, is called by comedi */
static int usbdux_ao_cancel(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct usbduxsub *this_usbduxsub = dev->private;
struct usbduxsub *devpriv = dev->private;
if (!this_usbduxsub)
return -EFAULT;
/* prevent other CPUs from submitting a command just now */
down(&this_usbduxsub->sem);
down(&devpriv->sem);
/* unlink only if it is really running */
usbdux_ao_stop(this_usbduxsub, this_usbduxsub->ao_cmd_running);
up(&this_usbduxsub->sem);
usbdux_ao_stop(devpriv, devpriv->ao_cmd_running);
up(&devpriv->sem);
return 0;
}
......@@ -1627,19 +1612,15 @@ static void usbdux_pwm_stop(struct usbduxsub *devpriv, int do_unlink)
devpriv->pwm_cmd_running = 0;
}
/* force unlink - is called by comedi */
static int usbdux_pwm_cancel(struct comedi_device *dev,
struct comedi_subdevice *s)
{
struct usbduxsub *this_usbduxsub = dev->private;
if (!this_usbduxsub)
return -EFAULT;
struct usbduxsub *devpriv = dev->private;
/* unlink only if it is really running */
usbdux_pwm_stop(this_usbduxsub, this_usbduxsub->pwm_cmd_running);
usbdux_pwm_stop(devpriv, devpriv->pwm_cmd_running);
return send_dux_commands(this_usbduxsub, SENDPWMOFF);
return send_dux_commands(devpriv, SENDPWMOFF);
}
static void usbduxsub_pwm_irq(struct urb *urb)
......
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