From: H Hartley Sweeten Date: Mon, 5 Oct 2015 21:23:08 +0000 (-0700) Subject: staging: comedi: quatech_daqp_cs: fix daqp_ai_cancel() X-Git-Tag: firefly_0821_release~176^2~802^2~918 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=848a7f7af0fb490274dc6031b0a79f4440a4948f;p=firefly-linux-kernel-4.4.55.git staging: comedi: quatech_daqp_cs: fix daqp_ai_cancel() Make sure interrupts are disabled and the event flags are cleared when an analog input async command is canceled. Remove the unnecessary calls to stop any running conversions in the (*insn_read) and (*do_cmd) functions. The comedi core will only call these functions if the subdevice is not busy (it has already been canceled). Signed-off-by: H Hartley Sweeten Reviewed-by: Ian Abbott Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/comedi/drivers/quatech_daqp_cs.c b/drivers/staging/comedi/drivers/quatech_daqp_cs.c index c44e7ec19e47..4b9626b832ca 100644 --- a/drivers/staging/comedi/drivers/quatech_daqp_cs.c +++ b/drivers/staging/comedi/drivers/quatech_daqp_cs.c @@ -171,19 +171,21 @@ static int daqp_clear_events(struct comedi_device *dev, int loops) return -EBUSY; } -/* Cancel a running acquisition */ - -static int daqp_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) +static int daqp_ai_cancel(struct comedi_device *dev, + struct comedi_subdevice *s) { struct daqp_private *devpriv = dev->private; if (devpriv->stop) return -EIO; + /* + * Stop any conversions, disable interrupts, and clear + * the status event flags. + */ outb(DAQP_CMD_STOP, dev->iobase + DAQP_CMD_REG); - - /* flush any linguring data in FIFO - superfluous here */ - /* outb(DAQP_CMD_RSTF, dev->iobase + DAQP_CMD_REG); */ + outb(0, dev->iobase + DAQP_CTRL_REG); + inb(dev->iobase + DAQP_STATUS_REG); return 0; } @@ -298,9 +300,6 @@ static int daqp_ai_insn_read(struct comedi_device *dev, if (devpriv->stop) return -EIO; - /* Stop any running conversion */ - daqp_ai_cancel(dev, s); - outb(0, dev->iobase + DAQP_AUX_REG); /* Reset scan list queue */ @@ -466,9 +465,6 @@ static int daqp_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) if (devpriv->stop) return -EIO; - /* Stop any running conversion */ - daqp_ai_cancel(dev, s); - outb(0, dev->iobase + DAQP_AUX_REG); /* Reset scan list queue */