int ni_tio_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { struct ni_gpct *counter = s->private; struct comedi_async *async = s->async; struct comedi_cmd *cmd = &async->cmd; int retval = 0; unsigned long flags; spin_lock_irqsave(&counter->lock, flags); if (!counter->mite_chan) { dev_err(counter->counter_dev->dev->class_dev, "commands only supported with DMA. "); dev_err(counter->counter_dev->dev->class_dev, "Interrupt-driven commands not yet implemented.\n"); retval = -EIO; } else { retval = ni_tio_cmd_setup(s); if (retval == 0) { if (cmd->flags & CMDF_WRITE) retval = ni_tio_output_cmd(s); else retval = ni_tio_input_cmd(s); } } spin_unlock_irqrestore(&counter->lock, flags); return retval; }
int ni_tio_cmd(struct ni_gpct *counter, struct comedi_async *async) { struct comedi_cmd *cmd = &async->cmd; int retval = 0; unsigned long flags; spin_lock_irqsave(&counter->lock, flags); if (counter->mite_chan == NULL) { printk(KERN_ERR "ni_tio: commands only supported with DMA. Interrupt-driven commands not yet implemented.\n"); retval = -EIO; } else { retval = ni_tio_cmd_setup(counter, async); if (retval == 0) { if (cmd->flags & CMDF_WRITE) retval = ni_tio_output_cmd(counter, async); else retval = ni_tio_input_cmd(counter, async); } } spin_unlock_irqrestore(&counter->lock, flags); return retval; }