aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-04-09 19:16:42 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-11 15:47:39 -0400
commit29a879b1250e13d777ac7f17b694ef0ead8cc472 (patch)
tree194a3cf919bcee67c60682e4496c8494724ea214 /drivers/staging
parent5c7fa612f48bfdaff2b655111bf46e5636b4f687 (diff)
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/comedi/drivers/das1800.c43
1 files changed, 11 insertions, 32 deletions
diff --git a/drivers/staging/comedi/drivers/das1800.c b/drivers/staging/comedi/drivers/das1800.c
index 1e90287303d8..cf265c1be7d8 100644
--- a/drivers/staging/comedi/drivers/das1800.c
+++ b/drivers/staging/comedi/drivers/das1800.c
@@ -1511,7 +1511,6 @@ static int das1800_attach(struct comedi_device *dev,
1511 const struct das1800_board *thisboard = comedi_board(dev); 1511 const struct das1800_board *thisboard = comedi_board(dev);
1512 struct das1800_private *devpriv; 1512 struct das1800_private *devpriv;
1513 struct comedi_subdevice *s; 1513 struct comedi_subdevice *s;
1514 unsigned long iobase = it->options[0];
1515 unsigned int irq = it->options[1]; 1514 unsigned int irq = it->options[1];
1516 unsigned int dma0 = it->options[2]; 1515 unsigned int dma0 = it->options[2];
1517 unsigned int dma1 = it->options[3]; 1516 unsigned int dma1 = it->options[3];
@@ -1524,31 +1523,9 @@ static int das1800_attach(struct comedi_device *dev,
1524 return -ENOMEM; 1523 return -ENOMEM;
1525 dev->private = devpriv; 1524 dev->private = devpriv;
1526 1525
1527 printk(KERN_DEBUG "comedi%d: %s: io 0x%lx", dev->minor, 1526 retval = comedi_request_region(dev, it->options[0], DAS1800_SIZE);
1528 dev->driver->driver_name, iobase); 1527 if (retval)
1529 if (irq) { 1528 return retval;
1530 printk(KERN_CONT ", irq %u", irq);
1531 if (dma0) {
1532 printk(KERN_CONT ", dma %u", dma0);
1533 if (dma1)
1534 printk(KERN_CONT " and %u", dma1);
1535 }
1536 }
1537 printk(KERN_CONT "\n");
1538
1539 if (iobase == 0) {
1540 dev_err(dev->class_dev, "io base address required\n");
1541 return -EINVAL;
1542 }
1543
1544 /* check if io addresses are available */
1545 if (!request_region(iobase, DAS1800_SIZE, dev->driver->driver_name)) {
1546 printk
1547 (" I/O port conflict: failed to allocate ports 0x%lx to 0x%lx\n",
1548 iobase, iobase + DAS1800_SIZE - 1);
1549 return -EIO;
1550 }
1551 dev->iobase = iobase;
1552 1529
1553 board = das1800_probe(dev); 1530 board = das1800_probe(dev);
1554 if (board < 0) { 1531 if (board < 0) {
@@ -1562,12 +1539,14 @@ static int das1800_attach(struct comedi_device *dev,
1562 1539
1563 /* if it is an 'ao' board with fancy analog out then we need extra io ports */ 1540 /* if it is an 'ao' board with fancy analog out then we need extra io ports */
1564 if (thisboard->ao_ability == 2) { 1541 if (thisboard->ao_ability == 2) {
1565 iobase2 = iobase + IOBASE2; 1542 iobase2 = dev->iobase + IOBASE2;
1566 if (!request_region(iobase2, DAS1800_SIZE, 1543 if (!request_region(iobase2, DAS1800_SIZE, dev->board_name)) {
1567 dev->driver->driver_name)) { 1544 release_region(dev->iobase, DAS1800_SIZE);
1568 printk 1545 dev_warn(dev->class_dev,
1569 (" I/O port conflict: failed to allocate ports 0x%lx to 0x%lx\n", 1546 "%s: I/O port conflict (%#lx,%d)\n",
1570 iobase2, iobase2 + DAS1800_SIZE - 1); 1547 dev->board_name,
1548 iobase2, DAS1800_SIZE);
1549 dev->iobase = 0;
1571 return -EIO; 1550 return -EIO;
1572 } 1551 }
1573 devpriv->iobase2 = iobase2; 1552 devpriv->iobase2 = iobase2;