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

index a342e3799c51d233c9af63b946bccaf70fd19097..9166af996f1618a5c81c5f7c8b94fd3ca9b77881 100644 (file)
@@ -1034,22 +1034,14 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        struct comedi_subdevice *s;
        int sdev_no, chans_left, n_dio_subdevs, n_subdevs, port, asic,
            thisasic_chanct = 0;
-       unsigned long iobase;
        unsigned int irq[MAX_ASICS];
        int ret;
 
-       iobase = it->options[0];
        irq[0] = it->options[1];
 
-       printk(KERN_INFO "comedi%d: %s: io: %lx attaching...\n", dev->minor,
-                       dev->board_name, iobase);
-
-       dev->iobase = iobase;
-
-       if (!iobase || !request_region(iobase, 32, dev->board_name)) {
-               printk(KERN_ERR "comedi%d: I/O port conflict\n", dev->minor);
-               return -EIO;
-       }
+       ret = comedi_request_region(dev, it->options[0], 32);
+       if (ret)
+               return ret;
 
        devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
        if (!devpriv)
@@ -1206,8 +1198,6 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
                                 * multiple irqs..
                                 */
 
-       printk(KERN_INFO "comedi%d: attached\n", dev->minor);
-
        return 1;
 }