staging: comedi: comedi_parport: use comedi_request_region()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 9 Apr 2013 23:32:24 +0000 (16:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Apr 2013 19:47:54 +0000 (12:47 -0700)
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.

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>
drivers/staging/comedi/drivers/comedi_parport.c

index e392f6837ab1e4ca449ea5a4182cd2766800e6b6..f9dc1e8a8dadef24f2193fe6f685abd35ec95eac 100644 (file)
@@ -261,17 +261,13 @@ static int parport_attach(struct comedi_device *dev,
                          struct comedi_devconfig *it)
 {
        struct parport_private *devpriv;
-       int ret;
-       unsigned int irq;
-       unsigned long iobase;
        struct comedi_subdevice *s;
+       unsigned int irq;
+       int ret;
 
-       iobase = it->options[0];
-       if (!request_region(iobase, PARPORT_SIZE, dev->board_name)) {
-               dev_err(dev->class_dev, "I/O port conflict\n");
-               return -EIO;
-       }
-       dev->iobase = iobase;
+       ret = comedi_request_region(dev, it->options[0], PARPORT_SIZE);
+       if (ret)
+               return ret;
 
        irq = it->options[1];
        if (irq) {
@@ -339,9 +335,6 @@ static int parport_attach(struct comedi_device *dev,
        devpriv->c_data = 0;
        outb(devpriv->c_data, dev->iobase + PARPORT_C);
 
-       dev_info(dev->class_dev, "%s: iobase=0x%04lx, irq %sabled",
-               dev->board_name, dev->iobase, dev->irq ? "en" : "dis");
-
        return 0;
 }