staging: comedi: das1800: 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 additional I/O space used on the 'ao' type boards. Modify the error message if that request fails so it matches to format of the comedi_request_region() message. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5c7fa612f4
commit
29a879b125
1 changed files with 11 additions and 32 deletions
|
@ -1511,7 +1511,6 @@ static int das1800_attach(struct comedi_device *dev,
|
|||
const struct das1800_board *thisboard = comedi_board(dev);
|
||||
struct das1800_private *devpriv;
|
||||
struct comedi_subdevice *s;
|
||||
unsigned long iobase = it->options[0];
|
||||
unsigned int irq = it->options[1];
|
||||
unsigned int dma0 = it->options[2];
|
||||
unsigned int dma1 = it->options[3];
|
||||
|
@ -1524,31 +1523,9 @@ static int das1800_attach(struct comedi_device *dev,
|
|||
return -ENOMEM;
|
||||
dev->private = devpriv;
|
||||
|
||||
printk(KERN_DEBUG "comedi%d: %s: io 0x%lx", dev->minor,
|
||||
dev->driver->driver_name, iobase);
|
||||
if (irq) {
|
||||
printk(KERN_CONT ", irq %u", irq);
|
||||
if (dma0) {
|
||||
printk(KERN_CONT ", dma %u", dma0);
|
||||
if (dma1)
|
||||
printk(KERN_CONT " and %u", dma1);
|
||||
}
|
||||
}
|
||||
printk(KERN_CONT "\n");
|
||||
|
||||
if (iobase == 0) {
|
||||
dev_err(dev->class_dev, "io base address required\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* check if io addresses are available */
|
||||
if (!request_region(iobase, DAS1800_SIZE, dev->driver->driver_name)) {
|
||||
printk
|
||||
(" I/O port conflict: failed to allocate ports 0x%lx to 0x%lx\n",
|
||||
iobase, iobase + DAS1800_SIZE - 1);
|
||||
return -EIO;
|
||||
}
|
||||
dev->iobase = iobase;
|
||||
retval = comedi_request_region(dev, it->options[0], DAS1800_SIZE);
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
board = das1800_probe(dev);
|
||||
if (board < 0) {
|
||||
|
@ -1562,12 +1539,14 @@ static int das1800_attach(struct comedi_device *dev,
|
|||
|
||||
/* if it is an 'ao' board with fancy analog out then we need extra io ports */
|
||||
if (thisboard->ao_ability == 2) {
|
||||
iobase2 = iobase + IOBASE2;
|
||||
if (!request_region(iobase2, DAS1800_SIZE,
|
||||
dev->driver->driver_name)) {
|
||||
printk
|
||||
(" I/O port conflict: failed to allocate ports 0x%lx to 0x%lx\n",
|
||||
iobase2, iobase2 + DAS1800_SIZE - 1);
|
||||
iobase2 = dev->iobase + IOBASE2;
|
||||
if (!request_region(iobase2, DAS1800_SIZE, dev->board_name)) {
|
||||
release_region(dev->iobase, DAS1800_SIZE);
|
||||
dev_warn(dev->class_dev,
|
||||
"%s: I/O port conflict (%#lx,%d)\n",
|
||||
dev->board_name,
|
||||
iobase2, DAS1800_SIZE);
|
||||
dev->iobase = 0;
|
||||
return -EIO;
|
||||
}
|
||||
devpriv->iobase2 = iobase2;
|
||||
|
|
Loading…
Add table
Reference in a new issue