[PATCH 12/12] staging: comedi: comedi_pci: free_irq() in comedi_pci_disable()

Ian Abbott abbotti at mev.co.uk
Thu Apr 18 12:06:02 UTC 2013


On 2013-04-17 19:20, H Hartley Sweeten wrote:
> All the PCI comedi drivers call comedi_pci_disable() either directly
> or as part of their (*detach). Move the free_irq() into comedi_pci_disable()
> so that the drivers don't have to deal with it.
>
> For drivers that then only call comedi_pci_disable() in their
> private (*detach), remove the private function and use the helper
> directly for the (*detach).
>
> For aesthetic reasons, tidy up the (*detach) in the icp_multi, ni_6527,
> and ni_65xx drivers.
>
> In the rtd520 driver, the write to the PLX_INTRCS_REG register to disable
> the interrupts is not needed. The previous call to rtd_reset() already
> cleared the register.
>
> Signed-off-by: H Hartley Sweeten <hsweeten at visionengravers.com>
> Cc: Ian Abbott <abbotti at mev.co.uk>
> Cc: Greg Kroah-Hartman <gregkh at linuxfoundation.org>

There is potential for this being unsafe for some drivers, particularly 
for those interrupt handlers that don't check dev->attached as a 
precaution before doing anything else, but instead read some ioremapped 
register to check whether it needs to do anything.  PCI devices used 
shared IRQs so their interrupt handlers can be called even when the 
device is not interrupting.

The only ones below that seem to suffer from the above problem are 
cb_pcidas64.c, icp_multi.c, and ni6527.c.  Just checking dev->attached 
and returning early before using anything that might have already been 
freed would be enough to solve the problem for those drivers.

amplc_pci224.c's interrupt handler also reads an interrupt status 
register at the start, but since it isn't ioremapped, it shouldn't matter.

ni_labpc.c's interrupt handler doesn't have the problem, although it 
does print a nasty message if !dev->attached and returns IRQ_HANDLED 
instead of IRQ_NONE.  I just noticed it in passing, so am leaving this 
here as a reminder.

I recommend skipping this patch until the problematic drivers are sorted 
out.

> ---
>   drivers/staging/comedi/comedi_pci.c                    |  5 +++++
>   drivers/staging/comedi/drivers/addi-data/addi_common.c |  2 --
>   drivers/staging/comedi/drivers/addi_apci_1032.c        |  2 --
>   drivers/staging/comedi/drivers/addi_apci_1710.c        |  2 --
>   drivers/staging/comedi/drivers/addi_apci_2032.c        |  2 --
>   drivers/staging/comedi/drivers/addi_apci_3120.c        |  2 --
>   drivers/staging/comedi/drivers/addi_apci_3501.c        |  2 --
>   drivers/staging/comedi/drivers/adl_pci9111.c           |  2 --
>   drivers/staging/comedi/drivers/adl_pci9118.c           |  2 --
>   drivers/staging/comedi/drivers/adv_pci1710.c           |  2 --
>   drivers/staging/comedi/drivers/amplc_dio200_common.c   |  2 --
>   drivers/staging/comedi/drivers/amplc_pc236.c           |  2 --
>   drivers/staging/comedi/drivers/amplc_pci224.c          |  2 --
>   drivers/staging/comedi/drivers/amplc_pci230.c          |  2 --
>   drivers/staging/comedi/drivers/cb_pcidas.c             |  2 --
>   drivers/staging/comedi/drivers/cb_pcidas64.c           |  2 --
>   drivers/staging/comedi/drivers/cb_pcimdas.c            |  9 +--------
>   drivers/staging/comedi/drivers/daqboard2000.c          |  2 --
>   drivers/staging/comedi/drivers/dt3000.c                |  2 --
>   drivers/staging/comedi/drivers/gsc_hpdi.c              |  2 --
>   drivers/staging/comedi/drivers/icp_multi.c             |  9 ++++-----
>   drivers/staging/comedi/drivers/me4000.c                |  2 --
>   drivers/staging/comedi/drivers/ni_6527.c               |  8 +++-----
>   drivers/staging/comedi/drivers/ni_65xx.c               | 18 ++++++------------
>   drivers/staging/comedi/drivers/ni_660x.c               |  2 --
>   drivers/staging/comedi/drivers/ni_labpc.c              |  5 +----
>   drivers/staging/comedi/drivers/ni_pcidio.c             |  2 --
>   drivers/staging/comedi/drivers/ni_pcimio.c             |  2 --
>   drivers/staging/comedi/drivers/rtd520.c                |  6 ------
>   drivers/staging/comedi/drivers/s626.c                  |  2 --
>   30 files changed, 20 insertions(+), 86 deletions(-)
>
> diff --git a/drivers/staging/comedi/comedi_pci.c b/drivers/staging/comedi/comedi_pci.c
> index 5fad084..62e3554 100644
> --- a/drivers/staging/comedi/comedi_pci.c
> +++ b/drivers/staging/comedi/comedi_pci.c
> @@ -21,6 +21,7 @@
>    */
>
>   #include <linux/pci.h>
> +#include <linux/interrupt.h>
>
>   #include "comedidev.h"
>
> @@ -69,6 +70,10 @@ void comedi_pci_disable(struct comedi_device *dev)
>          struct pci_dev *pcidev = comedi_to_pci_dev(dev);
>
>          if (pcidev && dev->ioenabled) {
> +               if (dev->irq) {
> +                       free_irq(dev->irq, dev);
> +                       dev->irq = 0;
> +               }
>                  pci_release_regions(pcidev);
>                  pci_disable_device(pcidev);
>          }
> diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c
> index 0c3db57..54f1843 100644
> --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c
> +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c
> @@ -321,8 +321,6 @@ static void i_ADDI_Detach(struct comedi_device *dev)
>          if (devpriv) {
>                  if (dev->iobase)
>                          i_ADDI_Reset(dev);
> -               if (dev->irq)
> -                       free_irq(dev->irq, dev);
>                  if (devpriv->dw_AiBase)
>                          iounmap(devpriv->dw_AiBase);
>          }
> diff --git a/drivers/staging/comedi/drivers/addi_apci_1032.c b/drivers/staging/comedi/drivers/addi_apci_1032.c
> index 3d4878f..a2e0d6e 100644
> --- a/drivers/staging/comedi/drivers/addi_apci_1032.c
> +++ b/drivers/staging/comedi/drivers/addi_apci_1032.c
> @@ -353,8 +353,6 @@ static void apci1032_detach(struct comedi_device *dev)
>   {
>          if (dev->iobase)
>                  apci1032_reset(dev);
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          comedi_pci_disable(dev);
>   }
>
> diff --git a/drivers/staging/comedi/drivers/addi_apci_1710.c b/drivers/staging/comedi/drivers/addi_apci_1710.c
> index c9e6471..03884a5 100644
> --- a/drivers/staging/comedi/drivers/addi_apci_1710.c
> +++ b/drivers/staging/comedi/drivers/addi_apci_1710.c
> @@ -62,8 +62,6 @@ static void apci1710_detach(struct comedi_device *dev)
>   {
>          if (dev->iobase)
>                  i_APCI1710_Reset(dev);
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          comedi_pci_disable(dev);
>   }
>
> diff --git a/drivers/staging/comedi/drivers/addi_apci_2032.c b/drivers/staging/comedi/drivers/addi_apci_2032.c
> index b666637..b5bbcf8 100644
> --- a/drivers/staging/comedi/drivers/addi_apci_2032.c
> +++ b/drivers/staging/comedi/drivers/addi_apci_2032.c
> @@ -350,8 +350,6 @@ static void apci2032_detach(struct comedi_device *dev)
>   {
>          if (dev->iobase)
>                  apci2032_reset(dev);
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (dev->read_subdev)
>                  kfree(dev->read_subdev->private);
>          comedi_spriv_free(dev, 1);
> diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c
> index 317a26d..b54e273 100644
> --- a/drivers/staging/comedi/drivers/addi_apci_3120.c
> +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
> @@ -208,8 +208,6 @@ static void apci3120_detach(struct comedi_device *dev)
>          if (devpriv) {
>                  if (dev->iobase)
>                          i_APCI3120_Reset(dev);
> -               if (dev->irq)
> -                       free_irq(dev->irq, dev);
>                  if (devpriv->ul_DmaBufferVirtual[0]) {
>                          free_pages((unsigned long)devpriv->
>                                  ul_DmaBufferVirtual[0],
> diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c
> index a0cf6ec..9beeee9 100644
> --- a/drivers/staging/comedi/drivers/addi_apci_3501.c
> +++ b/drivers/staging/comedi/drivers/addi_apci_3501.c
> @@ -423,8 +423,6 @@ static void apci3501_detach(struct comedi_device *dev)
>   {
>          if (dev->iobase)
>                  apci3501_reset(dev);
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          comedi_pci_disable(dev);
>   }
>
> diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c
> index 6247fdc..9d6a525 100644
> --- a/drivers/staging/comedi/drivers/adl_pci9111.c
> +++ b/drivers/staging/comedi/drivers/adl_pci9111.c
> @@ -933,8 +933,6 @@ static void pci9111_detach(struct comedi_device *dev)
>   {
>          if (dev->iobase)
>                  pci9111_reset(dev);
> -       if (dev->irq != 0)
> -               free_irq(dev->irq, dev);
>          comedi_pci_disable(dev);
>   }
>
> diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c
> index cb4ef2d..cb423e6 100644
> --- a/drivers/staging/comedi/drivers/adl_pci9118.c
> +++ b/drivers/staging/comedi/drivers/adl_pci9118.c
> @@ -2190,8 +2190,6 @@ static void pci9118_detach(struct comedi_device *dev)
>          if (devpriv) {
>                  if (devpriv->valid)
>                          pci9118_reset(dev);
> -               if (dev->irq)
> -                       free_irq(dev->irq, dev);
>                  if (devpriv->dmabuf_virt[0])
>                          free_pages((unsigned long)devpriv->dmabuf_virt[0],
>                                     devpriv->dmabuf_pages[0]);
> diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c
> index f847bbc..520a1b4 100644
> --- a/drivers/staging/comedi/drivers/adv_pci1710.c
> +++ b/drivers/staging/comedi/drivers/adv_pci1710.c
> @@ -1364,8 +1364,6 @@ static void pci1710_detach(struct comedi_device *dev)
>   {
>          if (dev->iobase)
>                  pci1710_reset(dev);
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          comedi_pci_disable(dev);
>   }
>
> diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> index 3403e5c..5cea2bd 100644
> --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c
> +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c
> @@ -1235,8 +1235,6 @@ void amplc_dio200_common_detach(struct comedi_device *dev)
>
>          if (!thisboard || !devpriv)
>                  return;
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (dev->subdevices) {
>                  layout = dio200_board_layout(thisboard);
>                  for (n = 0; n < dev->n_subdevices; n++) {
> diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c
> index 115ecd5..5e3b600 100644
> --- a/drivers/staging/comedi/drivers/amplc_pc236.c
> +++ b/drivers/staging/comedi/drivers/amplc_pc236.c
> @@ -548,8 +548,6 @@ static void pc236_detach(struct comedi_device *dev)
>                  comedi_legacy_detach(dev);
>          } else if (is_pci_board(thisboard)) {
>                  struct pci_dev *pcidev = comedi_to_pci_dev(dev);
> -               if (dev->irq)
> -                       free_irq(dev->irq, dev);
>                  comedi_pci_disable(dev);
>                  if (pcidev)
>                          pci_dev_put(pcidev);
> diff --git a/drivers/staging/comedi/drivers/amplc_pci224.c b/drivers/staging/comedi/drivers/amplc_pci224.c
> index 4d7eab9..961bd85 100644
> --- a/drivers/staging/comedi/drivers/amplc_pci224.c
> +++ b/drivers/staging/comedi/drivers/amplc_pci224.c
> @@ -1471,8 +1471,6 @@ static void pci224_detach(struct comedi_device *dev)
>          struct pci224_private *devpriv = dev->private;
>          struct pci_dev *pcidev = comedi_to_pci_dev(dev);
>
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (dev->subdevices) {
>                  struct comedi_subdevice *s;
>
> diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c
> index 49200fb..d15702a 100644
> --- a/drivers/staging/comedi/drivers/amplc_pci230.c
> +++ b/drivers/staging/comedi/drivers/amplc_pci230.c
> @@ -2835,8 +2835,6 @@ static void pci230_detach(struct comedi_device *dev)
>          struct pci_dev *pcidev = comedi_to_pci_dev(dev);
>
>          comedi_spriv_free(dev, 2);
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          comedi_pci_disable(dev);
>          if (pcidev)
>                  pci_dev_put(pcidev);
> diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c
> index 53dd298..6cd84ab 100644
> --- a/drivers/staging/comedi/drivers/cb_pcidas.c
> +++ b/drivers/staging/comedi/drivers/cb_pcidas.c
> @@ -1606,8 +1606,6 @@ static void cb_pcidas_detach(struct comedi_device *dev)
>                               devpriv->s5933_config + AMCC_OP_REG_INTCSR);
>                  }
>          }
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          comedi_spriv_free(dev, 2);
>          comedi_pci_disable(dev);
>   }
> diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
> index c3e5495..b1a4bcc 100644
> --- a/drivers/staging/comedi/drivers/cb_pcidas64.c
> +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
> @@ -4121,8 +4121,6 @@ static void detach(struct comedi_device *dev)
>          struct pcidas64_private *devpriv = dev->private;
>          unsigned int i;
>
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (devpriv) {
>                  if (pcidev) {
>                          if (devpriv->plx9080_iobase) {
> diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c
> index 29813c9..19a13f4 100644
> --- a/drivers/staging/comedi/drivers/cb_pcimdas.c
> +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c
> @@ -273,18 +273,11 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev,
>          return 0;
>   }
>
> -static void cb_pcimdas_detach(struct comedi_device *dev)
> -{
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
> -       comedi_pci_disable(dev);
> -}
> -
>   static struct comedi_driver cb_pcimdas_driver = {
>          .driver_name    = "cb_pcimdas",
>          .module         = THIS_MODULE,
>          .auto_attach    = cb_pcimdas_auto_attach,
> -       .detach         = cb_pcimdas_detach,
> +       .detach         = comedi_pci_disable,
>   };
>
>   static int cb_pcimdas_pci_probe(struct pci_dev *dev,
> diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c
> index c1f14f0..fd8e3f0 100644
> --- a/drivers/staging/comedi/drivers/daqboard2000.c
> +++ b/drivers/staging/comedi/drivers/daqboard2000.c
> @@ -767,8 +767,6 @@ static void daqboard2000_detach(struct comedi_device *dev)
>          struct daqboard2000_private *devpriv = dev->private;
>
>          comedi_spriv_free(dev, 2);
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (devpriv) {
>                  if (devpriv->daq)
>                          iounmap(devpriv->daq);
> diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c
> index 7e03929..e6160b8 100644
> --- a/drivers/staging/comedi/drivers/dt3000.c
> +++ b/drivers/staging/comedi/drivers/dt3000.c
> @@ -811,8 +811,6 @@ static void dt3000_detach(struct comedi_device *dev)
>   {
>          struct dt3k_private *devpriv = dev->private;
>
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (devpriv) {
>                  if (devpriv->io_addr)
>                          iounmap(devpriv->io_addr);
> diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c
> index 0c061df..8fa98a4 100644
> --- a/drivers/staging/comedi/drivers/gsc_hpdi.c
> +++ b/drivers/staging/comedi/drivers/gsc_hpdi.c
> @@ -558,8 +558,6 @@ static void hpdi_detach(struct comedi_device *dev)
>          struct hpdi_private *devpriv = dev->private;
>          unsigned int i;
>
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (devpriv) {
>                  if (devpriv->plx9080_iobase) {
>                          disable_plx_interrupts(dev);
> diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c
> index 08ab9d6..dacf9c5 100644
> --- a/drivers/staging/comedi/drivers/icp_multi.c
> +++ b/drivers/staging/comedi/drivers/icp_multi.c
> @@ -589,13 +589,12 @@ static void icp_multi_detach(struct comedi_device *dev)
>   {
>          struct icp_multi_private *devpriv = dev->private;
>
> -       if (devpriv)
> +       if (devpriv) {
>                  if (devpriv->valid)
>                          icp_multi_reset(dev);
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
> -       if (devpriv && devpriv->io_addr)
> -               iounmap(devpriv->io_addr);
> +               if (devpriv->io_addr)
> +                       iounmap(devpriv->io_addr);
> +       }
>          comedi_pci_disable(dev);
>   }
>
> diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c
> index 641e693..697a1db 100644
> --- a/drivers/staging/comedi/drivers/me4000.c
> +++ b/drivers/staging/comedi/drivers/me4000.c
> @@ -1680,8 +1680,6 @@ static int me4000_auto_attach(struct comedi_device *dev,
>
>   static void me4000_detach(struct comedi_device *dev)
>   {
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (dev->iobase)
>                  me4000_reset(dev);
>          comedi_pci_disable(dev);
> diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c
> index d10f777..b2b56d6 100644
> --- a/drivers/staging/comedi/drivers/ni_6527.c
> +++ b/drivers/staging/comedi/drivers/ni_6527.c
> @@ -414,12 +414,10 @@ static void ni6527_detach(struct comedi_device *dev)
>   {
>          struct ni6527_private *devpriv = dev->private;
>
> -       if (devpriv && devpriv->mite && devpriv->mite->daq_io_addr)
> -               writeb(0x00,
> -                      devpriv->mite->daq_io_addr + Master_Interrupt_Control);
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (devpriv && devpriv->mite) {
> +               if (devpriv->mite->daq_io_addr)
> +                       writeb(0x00, devpriv->mite->daq_io_addr +
> +                                    Master_Interrupt_Control);
>                  mite_unsetup(devpriv->mite);
>                  mite_free(devpriv->mite);
>          }
> diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c
> index 3f71f0f..eacb3fa 100644
> --- a/drivers/staging/comedi/drivers/ni_65xx.c
> +++ b/drivers/staging/comedi/drivers/ni_65xx.c
> @@ -732,21 +732,15 @@ static void ni_65xx_detach(struct comedi_device *dev)
>          struct ni_65xx_private *devpriv = dev->private;
>          int i;
>
> -       if (devpriv && devpriv->mite && devpriv->mite->daq_io_addr) {
> -               writeb(0x00,
> -                      devpriv->mite->daq_io_addr +
> -                      Master_Interrupt_Control);
> +       if (devpriv && devpriv->mite) {
> +               if (devpriv->mite->daq_io_addr)
> +                       writeb(0x00, devpriv->mite->daq_io_addr +
> +                                    Master_Interrupt_Control);
> +               mite_unsetup(devpriv->mite);
> +               mite_free(devpriv->mite);
>          }
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          for (i = 0; i < dev->n_subdevices; ++i)
>                  comedi_spriv_free(dev, i);
> -       if (devpriv) {
> -               if (devpriv->mite) {
> -                       mite_unsetup(devpriv->mite);
> -                       mite_free(devpriv->mite);
> -               }
> -       }
>          comedi_pci_disable(dev);
>   }
>
> diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c
> index 5cdda7f..f4a64cc 100644
> --- a/drivers/staging/comedi/drivers/ni_660x.c
> +++ b/drivers/staging/comedi/drivers/ni_660x.c
> @@ -1298,8 +1298,6 @@ static void ni_660x_detach(struct comedi_device *dev)
>   {
>          struct ni_660x_private *devpriv = dev->private;
>
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (devpriv) {
>                  if (devpriv->counter_dev)
>                          ni_gpct_device_destroy(devpriv->counter_dev);
> diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
> index 96a6837..99f7698 100644
> --- a/drivers/staging/comedi/drivers/ni_labpc.c
> +++ b/drivers/staging/comedi/drivers/ni_labpc.c
> @@ -1877,11 +1877,8 @@ void labpc_common_detach(struct comedi_device *dev)
>                  mite_unsetup(devpriv->mite);
>                  mite_free(devpriv->mite);
>          }
> -       if (board->bustype == pci_bustype) {
> -               if (dev->irq)
> -                       free_irq(dev->irq, dev);
> +       if (board->bustype == pci_bustype)
>                  comedi_pci_disable(dev);
> -       }
>   #endif
>   }
>   EXPORT_SYMBOL_GPL(labpc_common_detach);
> diff --git a/drivers/staging/comedi/drivers/ni_pcidio.c b/drivers/staging/comedi/drivers/ni_pcidio.c
> index b5f340c..6073d7b 100644
> --- a/drivers/staging/comedi/drivers/ni_pcidio.c
> +++ b/drivers/staging/comedi/drivers/ni_pcidio.c
> @@ -1194,8 +1194,6 @@ static void nidio_detach(struct comedi_device *dev)
>   {
>          struct nidio96_private *devpriv = dev->private;
>
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (devpriv) {
>                  if (devpriv->di_mite_ring) {
>                          mite_free_ring(devpriv->di_mite_ring);
> diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c
> index 634d023..544193d 100644
> --- a/drivers/staging/comedi/drivers/ni_pcimio.c
> +++ b/drivers/staging/comedi/drivers/ni_pcimio.c
> @@ -1452,8 +1452,6 @@ static void pcimio_detach(struct comedi_device *dev)
>          struct ni_private *devpriv = dev->private;
>
>          mio_common_detach(dev);
> -       if (dev->irq)
> -               free_irq(dev->irq, dev);
>          if (devpriv) {
>                  mite_free_ring(devpriv->ai_mite_ring);
>                  mite_free_ring(devpriv->ao_mite_ring);
> diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c
> index 30a1728..f5ac925 100644
> --- a/drivers/staging/comedi/drivers/rtd520.c
> +++ b/drivers/staging/comedi/drivers/rtd520.c
> @@ -1438,12 +1438,6 @@ static void rtd_detach(struct comedi_device *dev)
>                  /* Shut down any board ops by resetting it */
>                  if (devpriv->las0 && devpriv->lcfg)
>                          rtd_reset(dev);
> -               if (dev->irq) {
> -                       writel(readl(devpriv->lcfg + PLX_INTRCS_REG) &
> -                               ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E),
> -                               devpriv->lcfg + PLX_INTRCS_REG);
> -                       free_irq(dev->irq, dev);
> -               }
>                  if (devpriv->las0)
>                          iounmap(devpriv->las0);
>                  if (devpriv->las1)
> diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
> index 0cf4b3d..98a1728 100644
> --- a/drivers/staging/comedi/drivers/s626.c
> +++ b/drivers/staging/comedi/drivers/s626.c
> @@ -2735,8 +2735,6 @@ static void s626_detach(struct comedi_device *dev)
>                          CloseDMAB(dev, &devpriv->ANABuf, DMABUF_SIZE);
>                  }
>
> -               if (dev->irq)
> -                       free_irq(dev->irq, dev);
>                  if (devpriv->mmio)
>                          iounmap(devpriv->mmio);
>          }
> --
> 1.8.1.4
>


-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-



More information about the devel mailing list