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>
This commit is contained in:
parent
d3629b2b12
commit
8189061ea4
1 changed files with 7 additions and 28 deletions
|
@ -854,7 +854,7 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||||
const struct pcl816_board *board = comedi_board(dev);
|
const struct pcl816_board *board = comedi_board(dev);
|
||||||
struct pcl816_private *devpriv;
|
struct pcl816_private *devpriv;
|
||||||
int ret;
|
int ret;
|
||||||
unsigned int irq, dma;
|
unsigned int dma;
|
||||||
unsigned long pages;
|
unsigned long pages;
|
||||||
/* int i; */
|
/* int i; */
|
||||||
struct comedi_subdevice *s;
|
struct comedi_subdevice *s;
|
||||||
|
@ -872,36 +872,15 @@ static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it)
|
||||||
if (!devpriv)
|
if (!devpriv)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
/* grab our IRQ */
|
if ((1 << it->options[1]) & board->IRQbits) {
|
||||||
irq = 0;
|
ret = request_irq(it->options[1], interrupt_pcl816, 0,
|
||||||
if (board->IRQbits != 0) { /* board support IRQ */
|
dev->board_name, dev);
|
||||||
irq = it->options[1];
|
if (ret == 0) {
|
||||||
if (irq) { /* we want to use IRQ */
|
dev->irq = it->options[1];
|
||||||
if (((1 << irq) & board->IRQbits) == 0) {
|
devpriv->irq_free = 1;
|
||||||
printk
|
|
||||||
(", IRQ %u is out of allowed range, "
|
|
||||||
"DISABLING IT", irq);
|
|
||||||
irq = 0; /* Bad IRQ */
|
|
||||||
} else {
|
|
||||||
if (request_irq(irq, interrupt_pcl816, 0,
|
|
||||||
dev->board_name, dev)) {
|
|
||||||
printk
|
|
||||||
(", unable to allocate IRQ %u, "
|
|
||||||
"DISABLING IT", irq);
|
|
||||||
irq = 0; /* Can't use IRQ */
|
|
||||||
} else {
|
|
||||||
printk(KERN_INFO ", irq=%u", irq);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->irq = irq;
|
|
||||||
if (irq) /* 1=we have allocated irq */
|
|
||||||
devpriv->irq_free = 1;
|
|
||||||
else
|
|
||||||
devpriv->irq_free = 0;
|
|
||||||
|
|
||||||
devpriv->irq_blocked = 0; /* number of subdevice which use IRQ */
|
devpriv->irq_blocked = 0; /* number of subdevice which use IRQ */
|
||||||
devpriv->int816_mode = 0; /* mode of irq */
|
devpriv->int816_mode = 0; /* mode of irq */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue