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 <[email protected]>
Cc: Ian Abbott <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
---
 drivers/staging/comedi/drivers/ni_mio_cs.c | 63 +++++++-----------------------
 1 file changed, 14 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c 
b/drivers/staging/comedi/drivers/ni_mio_cs.c
index a9cd552..4e03c46 100644
--- a/drivers/staging/comedi/drivers/ni_mio_cs.c
+++ b/drivers/staging/comedi/drivers/ni_mio_cs.c
@@ -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)
-- 
1.8.0.2

_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel

Reply via email to