/* 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)
/* 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;
	int res = 0;
	this_usbduxsub = dev->private;
	if (!this_usbduxsub)
		return -EFAULT;
	dev_dbg(&this_usbduxsub->interface->dev, "comedi: usbdux_ai_cancel\n");
	down(&this_usbduxsub->sem);
	if (!(this_usbduxsub->probed)) {
		up(&this_usbduxsub->sem);
		return -ENODEV;
	}
	res = usbdux_ai_stop(this_usbduxsub, this_usbduxsub->ai_cmd_running);
	up(&this_usbduxsub->sem);
	return res;
}