]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
staging: comedi: pcl711: don't fail attach if irq is unavailable
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Fri, 20 Sep 2013 23:35:52 +0000 (16:35 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 Sep 2013 22:59:57 +0000 (15:59 -0700)
Interrupts are only needed to support asynchronous commands with the
analog input subdevice. Since the interrupt is optional during the
attach of the board, don't fail the attach if it's not available.

Also, remove the printk() noise about the irq. The user will know if
the interrupt is available due to the subdev_flag SDF_CMD_READ being
set for the analog input subdevice.

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>
drivers/staging/comedi/drivers/pcl711.c

index 92a4dcc332ad45c3fc2b0d60efec1a401aa69140..45a8614fb2f65a4947e397f534fd3e99427750d0 100644 (file)
@@ -477,29 +477,18 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        const struct pcl711_board *board = comedi_board(dev);
        struct pcl711_private *devpriv;
        int ret;
-       unsigned int irq;
        struct comedi_subdevice *s;
 
        ret = comedi_request_region(dev, it->options[0], PCL711_SIZE);
        if (ret)
                return ret;
 
-       /* grab our IRQ */
-       irq = it->options[1];
-       if (irq > board->maxirq) {
-               printk(KERN_ERR "irq out of range\n");
-               return -EINVAL;
+       if (it->options[1] && it->options[1] <= board->maxirq) {
+               ret = request_irq(it->options[1], pcl711_interrupt, 0,
+                                 dev->board_name, dev);
+               if (ret == 0)
+                       dev->irq = it->options[1];
        }
-       if (irq) {
-               if (request_irq(irq, pcl711_interrupt, 0, dev->board_name,
-                               dev)) {
-                       printk(KERN_ERR "unable to allocate irq %u\n", irq);
-                       return -EINVAL;
-               } else {
-                       printk(KERN_INFO "( irq = %u )\n", irq);
-               }
-       }
-       dev->irq = irq;
 
        ret = comedi_alloc_subdevices(dev, 4);
        if (ret)
@@ -518,7 +507,7 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it)
        s->len_chanlist = 1;
        s->range_table = board->ai_range_type;
        s->insn_read = pcl711_ai_insn;
-       if (irq) {
+       if (dev->irq) {
                dev->read_subdev = s;
                s->subdev_flags |= SDF_CMD_READ;
                s->do_cmdtest = pcl711_ai_cmdtest;