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

index 8a34f6f631fd3dee6a50e68beb6e7ea6c5ea2577..e80674e7db9e0e1f9d5887fc0ddbb68354292b17 100644 (file)
@@ -139,27 +139,11 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        const struct boarddef_struct *board = comedi_board(dev);
        struct poc_private *devpriv;
        struct comedi_subdevice *s;
-       unsigned long iobase;
-       unsigned int iosize;
        int ret;
 
-       iobase = it->options[0];
-       printk(KERN_INFO "comedi%d: poc: using %s iobase 0x%lx\n", dev->minor,
-              board->name, iobase);
-
-       if (iobase == 0) {
-               printk(KERN_ERR "io base address required\n");
-               return -EINVAL;
-       }
-
-       iosize = board->iosize;
-       /* check if io addresses are available */
-       if (!request_region(iobase, iosize, dev->board_name)) {
-               printk(KERN_ERR "I/O port conflict: failed to allocate ports "
-                       "0x%lx to 0x%lx\n", iobase, iobase + iosize - 1);
-               return -EIO;
-       }
-       dev->iobase = iobase;
+       ret = comedi_request_region(dev, it->options[0], board->iosize);
+       if (ret)
+               return ret;
 
        ret = comedi_alloc_subdevices(dev, 1);
        if (ret)