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

index f5a55a6ac19b313d77af6bf671488db19e3819e2..b5814401a798bdab2dafea1bb95142c0701f4cc8 100644 (file)
@@ -593,17 +593,13 @@ static int dt2801_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        const struct dt2801_board *board = comedi_board(dev);
        struct dt2801_private *devpriv;
        struct comedi_subdevice *s;
-       unsigned long iobase;
        int board_code, type;
        int ret = 0;
        int n_ai_chans;
 
-       iobase = it->options[0];
-       if (!request_region(iobase, DT2801_IOSIZE, "dt2801")) {
-               comedi_error(dev, "I/O port conflict");
-               return -EIO;
-       }
-       dev->iobase = iobase;
+       ret = comedi_request_region(dev, it->options[0], DT2801_IOSIZE);
+       if (ret)
+               return ret;
 
        /* do some checking */
 
@@ -624,10 +620,8 @@ static int dt2801_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 havetype:
        dev->board_ptr = boardtypes + type;
        board = comedi_board(dev);
-       printk("dt2801: %s at port 0x%lx", board->name, iobase);
 
        n_ai_chans = probe_number_of_ai_chans(dev);
-       printk(" (ai channels = %d)\n", n_ai_chans);
 
        ret = comedi_alloc_subdevices(dev, 4);
        if (ret)