]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging: comedi: fl512: use comedi_request_region()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Tue, 9 Apr 2013 23:20:49 +0000 (16:20 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 Apr 2013 19:47:44 +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/fl512.c

index 07f9d6760364d750f3433d026ef7f7dc72112ad9..bf1c12b8ceb9d7a1a8dc56ae3b8d88c6f04ddd21 100644 (file)
@@ -111,30 +111,18 @@ static int fl512_ao_insn_readback(struct comedi_device *dev,
 static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 {
        struct fl512_private *devpriv;
-       unsigned long iobase;
-       int ret;
-
-       /* pointer to the subdevice: Analog in, Analog out,
-          (not made ->and Digital IO) */
        struct comedi_subdevice *s;
+       int ret;
 
-       iobase = it->options[0];
-       printk(KERN_INFO "comedi:%d fl512: 0x%04lx", dev->minor, iobase);
-       if (!request_region(iobase, FL512_SIZE, "fl512")) {
-               printk(KERN_WARNING " I/O port conflict\n");
-               return -EIO;
-       }
-       dev->iobase = iobase;
+       ret = comedi_request_region(dev, it->options[0], FL512_SIZE);
+       if (ret)
+               return ret;
 
        devpriv = kzalloc(sizeof(*devpriv), GFP_KERNEL);
        if (!devpriv)
                return -ENOMEM;
        dev->private = devpriv;
 
-#if DEBUG
-       printk(KERN_DEBUG "malloc ok\n");
-#endif
-
        ret = comedi_alloc_subdevices(dev, 2);
        if (ret)
                return ret;
@@ -156,7 +144,6 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        s->range_table = &range_fl512;
        /* function to call when read AD */
        s->insn_read = fl512_ai_insn;
-       printk(KERN_INFO "comedi: fl512: subdevice 0 initialized\n");
 
        /* Analog output */
        s = &dev->subdevices[1];
@@ -174,7 +161,6 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        s->insn_write = fl512_ao_insn;
        /* function to call when reading DA */
        s->insn_read = fl512_ao_insn_readback;
-       printk(KERN_INFO "comedi: fl512: subdevice 1 initialized\n");
 
        return 1;
 }