Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 42946cfc authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman
Browse files

staging: comedi: pcmad: use comedi_timeout()



Use comedi_timeout() to wait for the analog input end-of-conversion.

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 37e2b25f
Loading
Loading
Loading
Loading
+10 −11
Original line number Original line Diff line number Diff line
@@ -61,18 +61,17 @@ static const struct pcmad_board_struct pcmad_boards[] = {
	},
	},
};
};


#define TIMEOUT	100
static int pcmad_ai_eoc(struct comedi_device *dev,

			struct comedi_subdevice *s,
static int pcmad_ai_wait_for_eoc(struct comedi_device *dev,
			struct comedi_insn *insn,
				 int timeout)
			unsigned long context)
{
{
	int i;
	unsigned int status;


	for (i = 0; i < timeout; i++) {
	status = inb(dev->iobase + PCMAD_STATUS);
		if ((inb(dev->iobase + PCMAD_STATUS) & 0x3) == 0x3)
	if ((status & 0x3) == 0x3)
		return 0;
		return 0;
	}
	return -EBUSY;
	return -ETIME;
}
}


static int pcmad_ai_insn_read(struct comedi_device *dev,
static int pcmad_ai_insn_read(struct comedi_device *dev,
@@ -89,7 +88,7 @@ static int pcmad_ai_insn_read(struct comedi_device *dev,
	for (i = 0; i < insn->n; i++) {
	for (i = 0; i < insn->n; i++) {
		outb(chan, dev->iobase + PCMAD_CONVERT);
		outb(chan, dev->iobase + PCMAD_CONVERT);


		ret = pcmad_ai_wait_for_eoc(dev, TIMEOUT);
		ret = comedi_timeout(dev, s, insn, pcmad_ai_eoc, 0);
		if (ret)
		if (ret)
			return ret;
			return ret;