aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-11-26 18:41:46 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-03 12:20:20 -0500
commit0c2e55324199d89aaea816ce7a76571c3f88d158 (patch)
treee7eb1329a3a2c223ddec93347998788188905619
parent49220f916d9a90e468b60d9dd8fde789e239c632 (diff)
staging: comedi: dmm32at: tidy up the irq support in dmm32at_attach()
An irq is only needed by this driver in order to support async commands. Since it is optional, modify the attach so that if the request_irq() fails the attach does not fail. Remove the printk noise about the irq. Only hookup the async command support 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/dmm32at.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c
index 6fb8ce1d110c..1831f3288ca8 100644
--- a/drivers/staging/comedi/drivers/dmm32at.c
+++ b/drivers/staging/comedi/drivers/dmm32at.c
@@ -670,9 +670,6 @@ static int dmm32at_attach(struct comedi_device *dev,
670 int ret; 670 int ret;
671 struct comedi_subdevice *s; 671 struct comedi_subdevice *s;
672 unsigned char aihi, ailo, fifostat, aistat, intstat, airback; 672 unsigned char aihi, ailo, fifostat, aistat, intstat, airback;
673 unsigned int irq;
674
675 irq = it->options[1];
676 673
677 ret = comedi_request_region(dev, it->options[0], DMM32AT_MEMSIZE); 674 ret = comedi_request_region(dev, it->options[0], DMM32AT_MEMSIZE);
678 if (ret) 675 if (ret)
@@ -717,14 +714,11 @@ static int dmm32at_attach(struct comedi_device *dev,
717 return -EIO; 714 return -EIO;
718 } 715 }
719 716
720 /* board is there, register interrupt */ 717 if (it->options[1]) {
721 if (irq) { 718 ret = request_irq(it->options[1], dmm32at_isr, 0,
722 ret = request_irq(irq, dmm32at_isr, 0, dev->board_name, dev); 719 dev->board_name, dev);
723 if (ret < 0) { 720 if (ret == 0)
724 printk(KERN_ERR "dmm32at: irq conflict\n"); 721 dev->irq = it->options[1];
725 return ret;
726 }
727 dev->irq = irq;
728 } 722 }
729 723
730 devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); 724 devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv));
@@ -736,20 +730,22 @@ static int dmm32at_attach(struct comedi_device *dev,
736 return ret; 730 return ret;
737 731
738 s = &dev->subdevices[0]; 732 s = &dev->subdevices[0];
739 dev->read_subdev = s;
740 /* analog input subdevice */ 733 /* analog input subdevice */
741 s->type = COMEDI_SUBD_AI; 734 s->type = COMEDI_SUBD_AI;
742 /* we support single-ended (ground) and differential */ 735 /* we support single-ended (ground) and differential */
743 s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF | SDF_CMD_READ; 736 s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF;
744 s->n_chan = 32; 737 s->n_chan = 32;
745 s->maxdata = 0xffff; 738 s->maxdata = 0xffff;
746 s->range_table = &dmm32at_airanges; 739 s->range_table = &dmm32at_airanges;
747 s->len_chanlist = 32; /* This is the maximum chanlist length that
748 the board can handle */
749 s->insn_read = dmm32at_ai_rinsn; 740 s->insn_read = dmm32at_ai_rinsn;
750 s->do_cmd = dmm32at_ai_cmd; 741 if (dev->irq) {
751 s->do_cmdtest = dmm32at_ai_cmdtest; 742 dev->read_subdev = s;
752 s->cancel = dmm32at_ai_cancel; 743 s->subdev_flags |= SDF_CMD_READ;
744 s->len_chanlist = 32;
745 s->do_cmd = dmm32at_ai_cmd;
746 s->do_cmdtest = dmm32at_ai_cmdtest;
747 s->cancel = dmm32at_ai_cancel;
748 }
753 749
754 s = &dev->subdevices[1]; 750 s = &dev->subdevices[1];
755 /* analog output subdevice */ 751 /* analog output subdevice */