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

staging: comedi: me4000: fix the interrupt request/free

Only set the dev->irq when the request_irq is successful.
Use the dev->board_name for the name passed to request_irq.
Change the printk messages into dev_warn().
Make sure free_irq is called in the detach.
Signed-off-by: default avatarH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 39780a1c
...@@ -1781,8 +1781,6 @@ static int me4000_attach_pci(struct comedi_device *dev, ...@@ -1781,8 +1781,6 @@ static int me4000_attach_pci(struct comedi_device *dev,
if (!info->plx_regbase || !dev->iobase || !info->timer_regbase) if (!info->plx_regbase || !dev->iobase || !info->timer_regbase)
return -ENODEV; return -ENODEV;
dev->irq = pcidev->irq;
result = xilinx_download(dev); result = xilinx_download(dev);
if (result) if (result)
return result; return result;
...@@ -1811,23 +1809,22 @@ static int me4000_attach_pci(struct comedi_device *dev, ...@@ -1811,23 +1809,22 @@ static int me4000_attach_pci(struct comedi_device *dev,
s->range_table = &me4000_ai_range; s->range_table = &me4000_ai_range;
s->insn_read = me4000_ai_insn_read; s->insn_read = me4000_ai_insn_read;
if (dev->irq > 0) { if (pcidev->irq > 0) {
if (request_irq(dev->irq, me4000_ai_isr, if (request_irq(pcidev->irq, me4000_ai_isr,
IRQF_SHARED, "ME-4000", dev)) { IRQF_SHARED, dev->board_name, dev)) {
printk dev_warn(dev->class_dev,
("comedi%d: me4000: me4000_attach(): " "request_irq failed\n");
"Unable to allocate irq\n", dev->minor);
} else { } else {
dev->read_subdev = s; dev->read_subdev = s;
s->subdev_flags |= SDF_CMD_READ; s->subdev_flags |= SDF_CMD_READ;
s->cancel = me4000_ai_cancel; s->cancel = me4000_ai_cancel;
s->do_cmdtest = me4000_ai_do_cmd_test; s->do_cmdtest = me4000_ai_do_cmd_test;
s->do_cmd = me4000_ai_do_cmd; s->do_cmd = me4000_ai_do_cmd;
dev->irq = pcidev->irq;
} }
} else { } else {
printk(KERN_WARNING dev_warn(dev->class_dev, "No interrupt available\n");
"comedi%d: me4000: me4000_attach(): "
"No interrupt available\n", dev->minor);
} }
} else { } else {
s->type = COMEDI_SUBD_UNUSED; s->type = COMEDI_SUBD_UNUSED;
...@@ -1904,6 +1901,8 @@ static void me4000_detach(struct comedi_device *dev) ...@@ -1904,6 +1901,8 @@ static void me4000_detach(struct comedi_device *dev)
{ {
struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct pci_dev *pcidev = comedi_to_pci_dev(dev);
if (dev->irq)
free_irq(dev->irq, dev);
if (pcidev) { if (pcidev) {
if (dev->iobase) { if (dev->iobase) {
reset_board(dev); reset_board(dev);
......
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