Commit 678a6ff3 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: ni_mio_cs: cleanup mio_cs_attach()

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: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 616b7a47
...@@ -245,73 +245,38 @@ static int ni_getboardtype(struct comedi_device *dev, ...@@ -245,73 +245,38 @@ static int ni_getboardtype(struct comedi_device *dev,
return 0; 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 ni_private *devpriv;
struct pcmcia_device *link; struct pcmcia_device *link;
unsigned int irq;
int ret; int ret;
DPRINTK("mio_cs_attach(dev=%p,it=%p)\n", dev, it);
link = cur_dev; /* XXX hack */ link = cur_dev; /* XXX hack */
if (!link) if (!link)
return -EIO; return -EIO;
dev->iobase = link->resource[0]->start;
irq = link->irq;
dev->board_ptr = ni_boards + ni_getboardtype(dev, link); 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->board_name = boardtype.name;
dev->iobase = link->resource[0]->start;
ret = request_irq(irq, ni_E_interrupt, NI_E_IRQ_FLAGS, ret = request_irq(link->irq, ni_E_interrupt, NI_E_IRQ_FLAGS,
"ni_mio_cs", dev); dev->board_name, dev);
if (ret < 0) { if (ret < 0)
dev_err(dev->class_dev, "irq not available\n"); return ret;
return -EINVAL; dev->irq = link->irq;
}
dev->irq = irq;
ret = ni_alloc_private(dev); ret = ni_alloc_private(dev);
if (ret) if (ret)
return 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); devpriv = dev->private;
devpriv->stc_writew = mio_cs_win_out;
if (ret < 0) devpriv->stc_readw = mio_cs_win_in;
return ret; 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) static void mio_cs_detach(struct comedi_device *dev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment