Skip to content

Commit

Permalink
staging: comedi: cb_das16_cs: probe for the device first
Browse files Browse the repository at this point in the history
During the attach of the comedi_driver, the device type probe
can fail. We should do the probe before requesting the irq
for the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Frank Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
H Hartley Sweeten authored and Greg Kroah-Hartman committed Jun 26, 2012
1 parent 8c50aa1 commit 9a4d211
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions drivers/staging/comedi/drivers/cb_das16_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,30 +454,28 @@ static int das16cs_attach(struct comedi_device *dev,
if (!link)
return -EIO;

dev->board_ptr = das16cs_probe(dev, link);
if (!dev->board_ptr)
return -EIO;
thisboard = comedi_board(dev);

dev->board_name = thisboard->name;

dev->iobase = link->resource[0]->start;
dev_dbg(dev->class_dev, "I/O base=0x%04lx\n", dev->iobase);

dev_dbg(dev->class_dev, "fingerprint:\n");
for (i = 0; i < 48; i += 2)
dev_dbg(dev->class_dev, "%04x\n", inw(dev->iobase + i));


ret = request_irq(link->irq, das16cs_interrupt,
IRQF_SHARED, "cb_das16_cs", dev);
if (ret < 0)
return ret;

dev->irq = link->irq;

dev_dbg(dev->class_dev, "irq=%u\n", dev->irq);

dev->board_ptr = das16cs_probe(dev, link);
if (!dev->board_ptr)
return -EIO;
thisboard = comedi_board(dev);

dev->board_name = thisboard->name;

if (alloc_private(dev, sizeof(struct das16cs_private)) < 0)
return -ENOMEM;

Expand Down

0 comments on commit 9a4d211

Please sign in to comment.