]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
staging: comedi: ni_mio_cs: cleanup mio_cs_attach()
authorH Hartley Sweeten <hartleys@visionengravers.com>
Sat, 26 Jan 2013 00:35:37 +0000 (17:35 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Jan 2013 04:08:23 +0000 (23:08 -0500)
Remove the DPRINTK() function trace message as well as the #if 0'ed
out debug code that dumps the board "fingerprint".

Remove the need for the local variable that holds the link->irq
passed to request_irq(). Also, return the error code from that
function instead of assuming -EINVAL. Use the dev->board_name for
the resource string passed to request_irq() instead of the open
coded string "ni_mio_cs".

For aesthetic reasons, add some whitespace to the initializatio
of the devpriv values.

Just return the result of ni_E_init() instead of checking it for
an error, returning the error, or returning "0".

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/comedi/drivers/ni_mio_cs.c

index a9cd552a7284a3af984e8e291735fd4f99ad085d..4e03c46a556626105d565eab64a90d665e38d306 100644 (file)
@@ -245,73 +245,38 @@ static int ni_getboardtype(struct comedi_device *dev,
        return 0;
 }
 
-static int mio_cs_attach(struct comedi_device *dev, struct comedi_devconfig *it)
+static int mio_cs_attach(struct comedi_device *dev,
+                        struct comedi_devconfig *it)
 {
        struct ni_private *devpriv;
        struct pcmcia_device *link;
-       unsigned int irq;
        int ret;
 
-       DPRINTK("mio_cs_attach(dev=%p,it=%p)\n", dev, it);
-
        link = cur_dev;         /* XXX hack */
        if (!link)
                return -EIO;
 
-       dev->iobase = link->resource[0]->start;
-
-       irq = link->irq;
-
        dev->board_ptr = ni_boards + ni_getboardtype(dev, link);
-
-#if 0
-       {
-               int i;
-
-               printk("comedi%d: %s: DAQCard: io 0x%04lx, irq %u, ",
-                      dev->minor, dev->driver->driver_name, dev->iobase, irq);
-
-               printk(" board fingerprint:");
-               for (i = 0; i < 32; i += 2) {
-                       printk(" %04x %02x", inw(dev->iobase + i),
-                              inb(dev->iobase + i + 1));
-               }
-               printk("\n");
-               printk(" board fingerprint (windowed):");
-               for (i = 0; i < 10; i++)
-                       printk(" 0x%04x", win_in(i));
-               printk("\n");
-
-               printk("boardtype.name: %s\n", boardtype.name);
-       }
-#endif
-
        dev->board_name = boardtype.name;
+       dev->iobase = link->resource[0]->start;
 
-       ret = request_irq(irq, ni_E_interrupt, NI_E_IRQ_FLAGS,
-                         "ni_mio_cs", dev);
-       if (ret < 0) {
-               dev_err(dev->class_dev, "irq not available\n");
-               return -EINVAL;
-       }
-       dev->irq = irq;
+       ret = request_irq(link->irq, ni_E_interrupt, NI_E_IRQ_FLAGS,
+                         dev->board_name, dev);
+       if (ret < 0)
+               return ret;
+       dev->irq = link->irq;
 
        ret = ni_alloc_private(dev);
        if (ret)
                return ret;
-       devpriv = dev->private;
-
-       devpriv->stc_writew = &mio_cs_win_out;
-       devpriv->stc_readw = &mio_cs_win_in;
-       devpriv->stc_writel = &win_out2;
-       devpriv->stc_readl = &win_in2;
 
-       ret = ni_E_init(dev);
-
-       if (ret < 0)
-               return ret;
+       devpriv = dev->private;
+       devpriv->stc_writew     = mio_cs_win_out;
+       devpriv->stc_readw      = mio_cs_win_in;
+       devpriv->stc_writel     = win_out2;
+       devpriv->stc_readl      = win_in2;
 
-       return 0;
+       return ni_E_init(dev);
 }
 
 static void mio_cs_detach(struct comedi_device *dev)