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

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

staging: comedi: das16: use comedi_request_region()



Use comedi_request_region() to request the I/O region used by this
driver.

Remove the noise when the board is first attached as well as the
error message when the request_region() fails, comedi_request_reqion()
will output the error message if necessary.

This driver does a second request_region() for the I/O space needed
by the 8255 chip. Modify the error message if that request fails so
it matches to format of the comedi_request_region() message.

Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8234d51a
Loading
Loading
Loading
Loading
+14 −25
Original line number Diff line number Diff line
@@ -1079,13 +1079,11 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	struct comedi_subdevice *s;
	int ret;
	unsigned int irq;
	unsigned long iobase;
	unsigned int dma_chan;
	int timer_mode;
	unsigned long flags;
	struct comedi_krange *user_ai_range, *user_ao_range;

	iobase = it->options[0];
#if 0
	irq = it->options[1];
	timer_mode = it->options[8];
@@ -1097,8 +1095,6 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	if (timer_mode)
		irq = 0;

	printk(KERN_INFO "comedi%d: das16:", dev->minor);

	/*  check that clock setting is valid */
	if (it->options[3]) {
		if (it->options[3] != 0 &&
@@ -1116,33 +1112,26 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
	dev->private = devpriv;

	if (board->size < 0x400) {
		printk(" 0x%04lx-0x%04lx\n", iobase, iobase + board->size);
		if (!request_region(iobase, board->size, dev->board_name)) {
			printk(KERN_ERR " I/O port conflict\n");
			return -EIO;
		}
		ret = comedi_request_region(dev, it->options[0], board->size);
		if (ret)
			return ret;
	} else {
		printk(KERN_INFO " 0x%04lx-0x%04lx 0x%04lx-0x%04lx\n",
		       iobase, iobase + 0x0f,
		       iobase + 0x400,
		       iobase + 0x400 + (board->size & 0x3ff));
		if (!request_region(iobase, 0x10, dev->board_name)) {
			printk(KERN_ERR " I/O port conflict:  0x%04lx-0x%04lx\n",
			       iobase, iobase + 0x0f);
			return -EIO;
		}
		if (!request_region(iobase + 0x400, board->size & 0x3ff,
		ret = comedi_request_region(dev, it->options[0], 0x10);
		if (ret)
			return ret;
		/* Request an additional region for the 8255 */
		if (!request_region(dev->iobase + 0x400, board->size & 0x3ff,
				    dev->board_name)) {
			release_region(iobase, 0x10);
			printk(KERN_ERR " I/O port conflict:  0x%04lx-0x%04lx\n",
			       iobase + 0x400,
			       iobase + 0x400 + (board->size & 0x3ff));
			release_region(dev->iobase, 0x10);
			dev_warn(dev->class_dev,
				 "%s: I/O port conflict (%#lx,%d)\n",
				 dev->board_name,
				 dev->iobase + 0x400, board->size & 0x3ff);
			dev->iobase = 0;
			return -EIO;
		}
	}

	dev->iobase = iobase;

	/*  probe id bits to make sure they are consistent */
	if (das16_probe(dev, it)) {
		printk(KERN_ERR " id bits do not match selected board, aborting\n");