Commit e30b22a9 authored by H Hartley Sweeten's avatar H Hartley Sweeten Committed by Greg Kroah-Hartman

staging: comedi: pcl818: tidy up the irq support in pcl818_attach()

Tidy up the code that does the request_irq().
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eeb6f2d3
...@@ -1204,7 +1204,6 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1204,7 +1204,6 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
const struct pcl818_board *board = comedi_board(dev); const struct pcl818_board *board = comedi_board(dev);
struct pcl818_private *devpriv; struct pcl818_private *devpriv;
int ret; int ret;
unsigned int irq;
int dma; int dma;
unsigned long pages; unsigned long pages;
struct comedi_subdevice *s; struct comedi_subdevice *s;
...@@ -1228,28 +1227,15 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1228,28 +1227,15 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return -EIO; return -EIO;
} }
/* grab our IRQ */ if ((1 << it->options[1]) & board->IRQbits) {
irq = 0; ret = request_irq(it->options[1], interrupt_pcl818, 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;
irq = 0; /* Bad IRQ */
} else {
if (request_irq(irq, interrupt_pcl818, 0,
dev->board_name, dev)) {
irq = 0; /* Can't use IRQ */
}
}
} }
} }
dev->irq = irq;
if (irq)
devpriv->irq_free = 1; /* 1=we have allocated irq */
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->ai_mode = 0; /* mode of irq */ devpriv->ai_mode = 0; /* mode of irq */
...@@ -1311,7 +1297,7 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it) ...@@ -1311,7 +1297,7 @@ static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->range_table = board->ai_range_type; s->range_table = board->ai_range_type;
s->cancel = pcl818_ai_cancel; s->cancel = pcl818_ai_cancel;
s->insn_read = pcl818_ai_insn_read; s->insn_read = pcl818_ai_insn_read;
if (irq) { if (dev->irq) {
dev->read_subdev = s; dev->read_subdev = s;
s->subdev_flags |= SDF_CMD_READ; s->subdev_flags |= SDF_CMD_READ;
s->do_cmdtest = ai_cmdtest; s->do_cmdtest = ai_cmdtest;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment