diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-11-27 13:05:19 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-03 12:20:23 -0500 |
commit | 8189061ea4a2f877c3867a57b9a33e7e56a44636 (patch) | |
tree | 8821bf904ef1829c9e0331991d2a0076e45ab8c4 | |
parent | d3629b2b1241e75971026e6ce6671f5b59b9172c (diff) |
staging: comedi: pcl816: tidy up the irq support in pcl816_attach()
Tidy up the code that does the request_irq().
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/pcl816.c | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c index 149a28bbf086..57172156321b 100644 --- a/drivers/staging/comedi/drivers/pcl816.c +++ b/drivers/staging/comedi/drivers/pcl816.c | |||
@@ -854,7 +854,7 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
854 | const struct pcl816_board *board = comedi_board(dev); | 854 | const struct pcl816_board *board = comedi_board(dev); |
855 | struct pcl816_private *devpriv; | 855 | struct pcl816_private *devpriv; |
856 | int ret; | 856 | int ret; |
857 | unsigned int irq, dma; | 857 | unsigned int dma; |
858 | unsigned long pages; | 858 | unsigned long pages; |
859 | /* int i; */ | 859 | /* int i; */ |
860 | struct comedi_subdevice *s; | 860 | struct comedi_subdevice *s; |
@@ -872,36 +872,15 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
872 | if (!devpriv) | 872 | if (!devpriv) |
873 | return -ENOMEM; | 873 | return -ENOMEM; |
874 | 874 | ||
875 | /* grab our IRQ */ | 875 | if ((1 << it->options[1]) & board->IRQbits) { |
876 | irq = 0; | 876 | ret = request_irq(it->options[1], interrupt_pcl816, 0, |
877 | if (board->IRQbits != 0) { /* board support IRQ */ | 877 | dev->board_name, dev); |
878 | irq = it->options[1]; | 878 | if (ret == 0) { |
879 | if (irq) { /* we want to use IRQ */ | 879 | dev->irq = it->options[1]; |
880 | if (((1 << irq) & board->IRQbits) == 0) { | 880 | devpriv->irq_free = 1; |
881 | printk | ||
882 | (", IRQ %u is out of allowed range, " | ||
883 | "DISABLING IT", irq); | ||
884 | irq = 0; /* Bad IRQ */ | ||
885 | } else { | ||
886 | if (request_irq(irq, interrupt_pcl816, 0, | ||
887 | dev->board_name, dev)) { | ||
888 | printk | ||
889 | (", unable to allocate IRQ %u, " | ||
890 | "DISABLING IT", irq); | ||
891 | irq = 0; /* Can't use IRQ */ | ||
892 | } else { | ||
893 | printk(KERN_INFO ", irq=%u", irq); | ||
894 | } | ||
895 | } | ||
896 | } | 881 | } |
897 | } | 882 | } |
898 | 883 | ||
899 | dev->irq = irq; | ||
900 | if (irq) /* 1=we have allocated irq */ | ||
901 | devpriv->irq_free = 1; | ||
902 | else | ||
903 | devpriv->irq_free = 0; | ||
904 | |||
905 | devpriv->irq_blocked = 0; /* number of subdevice which use IRQ */ | 884 | devpriv->irq_blocked = 0; /* number of subdevice which use IRQ */ |
906 | devpriv->int816_mode = 0; /* mode of irq */ | 885 | devpriv->int816_mode = 0; /* mode of irq */ |
907 | 886 | ||