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: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
H Hartley Sweeten 2013-01-25 17:35:37 -07:00 committed by Greg Kroah-Hartman
parent 616b7a479e
commit 678a6ff3e9

View 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->board_ptr = ni_boards + ni_getboardtype(dev, link);
dev->board_name = boardtype.name;
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;
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;
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;
return 0;
return ni_E_init(dev);
}
static void mio_cs_detach(struct comedi_device *dev)