diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-08-30 18:47:11 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-09-17 14:47:42 (GMT) |
commit | 7e6f185e68d49c88ddc37973f8670e7fe88ad53b (patch) | |
tree | 76454bb7a4e91fae124272d574bca585157a0b3c | |
parent | b6ede0545894aa4d363875b9fb087d06e52b9cac (diff) | |
download | linux-fsl-qoriq-7e6f185e68d49c88ddc37973f8670e7fe88ad53b.tar.xz |
staging: comedi: comedi_parport: don't fail attach if irq is not available
Interrupt support in this driver is optional. Don't fail the attach of the
board if the request_irq() fails.
Only allocate and setup the subdevice for the interrupt if the request_irq()
was successful.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/comedi/drivers/comedi_parport.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c index 33b3b90..f7680c9 100644 --- a/drivers/staging/comedi/drivers/comedi_parport.c +++ b/drivers/staging/comedi/drivers/comedi_parport.c @@ -250,25 +250,20 @@ static int parport_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; - unsigned int irq; int ret; ret = comedi_request_region(dev, it->options[0], 0x03); if (ret) return ret; - irq = it->options[1]; - if (irq) { - ret = request_irq(irq, parport_interrupt, 0, dev->board_name, - dev); - if (ret < 0) { - dev_err(dev->class_dev, "irq not available\n"); - return -EINVAL; - } - dev->irq = irq; + if (it->options[1]) { + ret = request_irq(it->options[1], parport_interrupt, 0, + dev->board_name, dev); + if (ret == 0) + dev->irq = it->options[1]; } - ret = comedi_alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, dev->irq ? 4 : 3); if (ret) return ret; @@ -297,8 +292,8 @@ static int parport_attach(struct comedi_device *dev, s->range_table = &range_digital; s->insn_bits = parport_ctrl_reg_insn_bits; - s = &dev->subdevices[3]; - if (irq) { + if (dev->irq) { + s = &dev->subdevices[3]; dev->read_subdev = s; s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE | SDF_CMD_READ; @@ -309,8 +304,6 @@ static int parport_attach(struct comedi_device *dev, s->do_cmdtest = parport_intr_cmdtest; s->do_cmd = parport_intr_cmd; s->cancel = parport_intr_cancel; - } else { - s->type = COMEDI_SUBD_UNUSED; } outb(0, dev->iobase + PARPORT_DATA_REG); |