staging: comedi: drivers: use comedi_legacy_detach()
authorH Hartley Sweeten <hsweeten@visionengravers.com>
Thu, 18 Apr 2013 21:34:19 +0000 (14:34 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Apr 2013 18:19:54 +0000 (11:19 -0700)
Use comedi_legacy_detach() to release the I/O region requested
by these drivers.

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>
24 files changed:
drivers/staging/comedi/drivers/aio_aio12_8.c
drivers/staging/comedi/drivers/amplc_pc236.c
drivers/staging/comedi/drivers/c6xdigio.c
drivers/staging/comedi/drivers/comedi_parport.c
drivers/staging/comedi/drivers/das08_isa.c
drivers/staging/comedi/drivers/das6402.c
drivers/staging/comedi/drivers/das800.c
drivers/staging/comedi/drivers/dmm32at.c
drivers/staging/comedi/drivers/dt2811.c
drivers/staging/comedi/drivers/dt2814.c
drivers/staging/comedi/drivers/dt282x.c
drivers/staging/comedi/drivers/ni_at_a2150.c
drivers/staging/comedi/drivers/ni_atmio.c
drivers/staging/comedi/drivers/ni_atmio16d.c
drivers/staging/comedi/drivers/ni_labpc.c
drivers/staging/comedi/drivers/pcl711.c
drivers/staging/comedi/drivers/pcl724.c
drivers/staging/comedi/drivers/pcl726.c
drivers/staging/comedi/drivers/pcl816.c
drivers/staging/comedi/drivers/pcl818.c
drivers/staging/comedi/drivers/pcm3724.c
drivers/staging/comedi/drivers/pcmad.c
drivers/staging/comedi/drivers/pcmmio.c
drivers/staging/comedi/drivers/pcmuio.c

index a3ca5c6b6a0669d7bb98228265f2b77758f3cc5d..e2dc08a058bc680d42ce67299d63abed2f3806e8 100644 (file)
@@ -262,8 +262,7 @@ static int aio_aio12_8_attach(struct comedi_device *dev,
 static void aio_aio12_8_detach(struct comedi_device *dev)
 {
        comedi_spriv_free(dev, 2);
-       if (dev->iobase)
-               release_region(dev->iobase, 24);
+       comedi_legacy_detach(dev);
 }
 
 static struct comedi_driver aio_aio12_8_driver = {
index 0f1a0f806cc69af16a40c023e6bfa50b74a6fec9..cb73c3665c97e71002779c2bc3fdc85d7558cf06 100644 (file)
@@ -547,8 +547,7 @@ static void pc236_detach(struct comedi_device *dev)
                free_irq(dev->irq, dev);
        comedi_spriv_free(dev, 0);
        if (is_isa_board(thisboard)) {
-               if (dev->iobase)
-                       release_region(dev->iobase, PC236_IO_SIZE);
+               comedi_legacy_detach(dev);
        } else if (is_pci_board(thisboard)) {
                struct pci_dev *pcidev = comedi_to_pci_dev(dev);
                comedi_pci_disable(dev);
index 0279e06c7bf30d06f2a0fd0ae0d052200744b6d4..92376dc86dd8883695459d54c4f99dfc4dbc168d 100644 (file)
@@ -468,8 +468,7 @@ static int c6xdigio_attach(struct comedi_device *dev,
 
 static void c6xdigio_detach(struct comedi_device *dev)
 {
-       if (dev->iobase)
-               release_region(dev->iobase, C6XDIGIO_SIZE);
+       comedi_legacy_detach(dev);
        pnp_unregister_driver(&c6xdigio_pnp_driver);
 }
 
index f9dc1e8a8dadef24f2193fe6f685abd35ec95eac..1355e7573f3076ad533844b300844e068badd5ae 100644 (file)
@@ -340,10 +340,9 @@ static int parport_attach(struct comedi_device *dev,
 
 static void parport_detach(struct comedi_device *dev)
 {
-       if (dev->iobase)
-               release_region(dev->iobase, PARPORT_SIZE);
        if (dev->irq)
                free_irq(dev->irq, dev);
+       comedi_legacy_detach(dev);
 }
 
 static struct comedi_driver parport_driver = {
index a6de825cff12bcfd5a008d63d6934e6ad3769cff..f09f6966ed6558fff3c51c6364eba4b75302d5ab 100644 (file)
@@ -195,11 +195,8 @@ static int das08_isa_attach(struct comedi_device *dev,
 
 static void das08_isa_detach(struct comedi_device *dev)
 {
-       const struct das08_board_struct *thisboard = comedi_board(dev);
-
        das08_common_detach(dev);
-       if (dev->iobase)
-               release_region(dev->iobase, thisboard->iosize);
+       comedi_legacy_detach(dev);
 }
 
 static struct comedi_driver das08_isa_driver = {
index 431dd227c64f29f68ed218a94758caf6e6a1ef22..b4c26fb59c24ac6dfa7b0536c177400cc24ae9d9 100644 (file)
@@ -328,8 +328,7 @@ static void das6402_detach(struct comedi_device *dev)
 {
        if (dev->irq)
                free_irq(dev->irq, dev);
-       if (dev->iobase)
-               release_region(dev->iobase, DAS6402_SIZE);
+       comedi_legacy_detach(dev);
 }
 
 static struct comedi_driver das6402_driver = {
index d56584d171c8ef0e2f32654b116cf1d5bd782d6c..3456d9eb18e19cb558462b216c08f8da4dcc3a7c 100644 (file)
@@ -524,11 +524,10 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
 static void das800_detach(struct comedi_device *dev)
 {
-       if (dev->iobase)
-               release_region(dev->iobase, DAS800_SIZE);
        if (dev->irq)
                free_irq(dev->irq, dev);
-};
+       comedi_legacy_detach(dev);
+}
 
 static int das800_cancel(struct comedi_device *dev, struct comedi_subdevice *s)
 {
index 7621cdf27b3af3ca499f43713b41ff86ee7eef7f..507ca8e4be60de8c7e79cb762e4cfcb1c492f232 100644 (file)
@@ -824,8 +824,7 @@ static void dmm32at_detach(struct comedi_device *dev)
 {
        if (dev->irq)
                free_irq(dev->irq, dev);
-       if (dev->iobase)
-               release_region(dev->iobase, DMM32AT_MEMSIZE);
+       comedi_legacy_detach(dev);
 }
 
 static struct comedi_driver dmm32at_driver = {
index 16cbd540ab31ee65d5381189d6a17fba2d3a87f1..e878059e6a24d82df71836a08a600868e22d51ba 100644 (file)
@@ -560,8 +560,7 @@ static void dt2811_detach(struct comedi_device *dev)
 {
        if (dev->irq)
                free_irq(dev->irq, dev);
-       if (dev->iobase)
-               release_region(dev->iobase, DT2811_SIZE);
+       comedi_legacy_detach(dev);
 }
 
 static const struct dt2811_board boardtypes[] = {
index 46dca8e8a8a1f085ba241455cbeeffca99638dc7..e47822e09eaff6ec90ce8448b236d343ff1cf6fd 100644 (file)
@@ -327,8 +327,7 @@ static void dt2814_detach(struct comedi_device *dev)
 {
        if (dev->irq)
                free_irq(dev->irq, dev);
-       if (dev->iobase)
-               release_region(dev->iobase, DT2814_SIZE);
+       comedi_legacy_detach(dev);
 }
 
 static struct comedi_driver dt2814_driver = {
index 06610453ef63daf397a136c1828ca1315235b1c2..6badbd404e46c8579b2bf0ffc8062789f8b3e0cd 100644 (file)
@@ -1273,8 +1273,6 @@ static void dt282x_detach(struct comedi_device *dev)
 
        if (dev->irq)
                free_irq(dev->irq, dev);
-       if (dev->iobase)
-               release_region(dev->iobase, DT2821_SIZE);
        if (dev->private) {
                if (devpriv->dma[0].chan)
                        free_dma(devpriv->dma[0].chan);
@@ -1285,6 +1283,7 @@ static void dt282x_detach(struct comedi_device *dev)
                if (devpriv->dma[1].buf)
                        free_page((unsigned long)devpriv->dma[1].buf);
        }
+       comedi_legacy_detach(dev);
 }
 
 static const struct dt282x_board boardtypes[] = {
index 8cd66046872a20076b1b3d0e0b2e48533bb55604..3079615b8a295ed93bf38dd58e365a5438c0e6d0 100644 (file)
@@ -827,10 +827,8 @@ static void a2150_detach(struct comedi_device *dev)
 {
        struct a2150_private *devpriv = dev->private;
 
-       if (dev->iobase) {
+       if (dev->iobase)
                outw(APD_BIT | DPD_BIT, dev->iobase + CONFIG_REG);
-               release_region(dev->iobase, A2150_SIZE);
-       }
        if (dev->irq)
                free_irq(dev->irq, dev);
        if (devpriv) {
@@ -838,6 +836,7 @@ static void a2150_detach(struct comedi_device *dev)
                        free_dma(devpriv->dma);
                kfree(devpriv->dma_buffer);
        }
+       comedi_legacy_detach(dev);
 };
 
 static struct comedi_driver ni_at_a2150_driver = {
index 02e5ae1b4be90d8e936349e0e5b12e26e74f2e2e..d439f6b5a995b125689fab8ca294389a14e56d37 100644 (file)
@@ -499,10 +499,9 @@ static void ni_atmio_detach(struct comedi_device *dev)
        struct ni_private *devpriv = dev->private;
 
        mio_common_detach(dev);
-       if (dev->iobase)
-               release_region(dev->iobase, NI_SIZE);
        if (dev->irq)
                free_irq(dev->irq, dev);
+       comedi_legacy_detach(dev);
        if (devpriv->isapnp_dev)
                pnp_device_detach(devpriv->isapnp_dev);
 }
index 4fb36cd833df1f7ffeee4a97165c899cc34ba33d..1414970f8ab4f1a88b8644f2efad344a9ef68189 100644 (file)
@@ -771,8 +771,7 @@ static void atmio16d_detach(struct comedi_device *dev)
        if (dev->irq)
                free_irq(dev->irq, dev);
        reset_atmio16d(dev);
-       if (dev->iobase)
-               release_region(dev->iobase, ATMIO16D_SIZE);
+       comedi_legacy_detach(dev);
 }
 
 static const struct atmio16_board_t atmio16_boards[] = {
index d48511f0cacd543c582af75c230ff460886fd06f..1137281004d20cca2280e3228298c61c400fd0b9 100644 (file)
@@ -1872,8 +1872,8 @@ void labpc_common_detach(struct comedi_device *dev)
 #endif
        if (dev->irq)
                free_irq(dev->irq, dev);
-       if (board->bustype == isa_bustype && dev->iobase)
-               release_region(dev->iobase, LABPC_SIZE);
+       if (board->bustype == isa_bustype)
+               comedi_legacy_detach(dev);
 #ifdef CONFIG_COMEDI_PCI_DRIVERS
        if (devpriv->mite) {
                mite_unsetup(devpriv->mite);
index 4610aa8e0f28543b443e69c125900176ed93ed31..92fb486599dff36cdfe957e25c17f4a90b24bef6 100644 (file)
@@ -554,8 +554,7 @@ static void pcl711_detach(struct comedi_device *dev)
 {
        if (dev->irq)
                free_irq(dev->irq, dev);
-       if (dev->iobase)
-               release_region(dev->iobase, PCL711_SIZE);
+       comedi_legacy_detach(dev);
 }
 
 static const struct pcl711_board boardtypes[] = {
index 0f5a4821cf5fa0890522c798ffb2b7c1efbc9424..3a3e4f58a08322fdef64a74ad1837196b948489f 100644 (file)
@@ -169,7 +169,6 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
 static void pcl724_detach(struct comedi_device *dev)
 {
-       const struct pcl724_board *board = comedi_board(dev);
        int i;
 
        for (i = 0; i < dev->n_subdevices; i++)
@@ -178,7 +177,7 @@ static void pcl724_detach(struct comedi_device *dev)
        if (dev->irq)
                free_irq(dev->irq, dev);
 #endif
-       release_region(dev->iobase, board->io_range);
+       comedi_legacy_detach(dev);
 }
 
 static const struct pcl724_board boardtypes[] = {
index cc35ff5b3f165352e6bdd242c0d5f347ee6e5401..5d0c4fe66446fe9b8fef896a8ac99749213003d7 100644 (file)
@@ -337,14 +337,11 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
 static void pcl726_detach(struct comedi_device *dev)
 {
-       const struct pcl726_board *board = comedi_board(dev);
-
 #ifdef ACL6126_IRQ
        if (dev->irq)
                free_irq(dev->irq, dev);
 #endif
-       if (dev->iobase)
-               release_region(dev->iobase, board->io_range);
+       comedi_legacy_detach(dev);
 }
 
 static struct comedi_driver pcl726_driver = {
index 2fd688a5c63e65dbc743515623856b8899389a57..4ea6fec5d342ee7c2afe5102308c38d829cfe533 100644 (file)
@@ -1195,7 +1195,6 @@ case COMEDI_SUBD_DO:
 
 static void pcl816_detach(struct comedi_device *dev)
 {
-       const struct pcl816_board *board = comedi_board(dev);
        struct pcl816_private *devpriv = dev->private;
 
        if (dev->private) {
@@ -1219,12 +1218,11 @@ static void pcl816_detach(struct comedi_device *dev)
        }
        if (dev->irq)
                free_irq(dev->irq, dev);
-       if (dev->iobase)
-               release_region(dev->iobase, board->io_range);
 #ifdef unused
        if (devpriv->dma_rtc)
                RTC_lock--;
 #endif
+       comedi_legacy_detach(dev);
 }
 
 static const struct pcl816_board boardtypes[] = {
index 8a1a8a5dc8c85f515f550fba7413671e5985a959..cd76da66575d2cbfdc551a039ac3749dd03d53e5 100644 (file)
@@ -1900,8 +1900,7 @@ static void pcl818_detach(struct comedi_device *dev)
        }
        if (dev->irq)
                free_irq(dev->irq, dev);
-       if (dev->iobase)
-               release_region(dev->iobase, devpriv->io_range);
+       comedi_legacy_detach(dev);
 }
 
 static const struct pcl818_board boardtypes[] = {
index 19742d1ba56846e5184589a03dd3b1edfbd94bb2..4ef0df30b07a1b11349378940294f9df49e5d997 100644 (file)
@@ -256,8 +256,7 @@ static void pcm3724_detach(struct comedi_device *dev)
 
        for (i = 0; i < dev->n_subdevices; i++)
                comedi_spriv_free(dev, i);
-       if (dev->iobase)
-               release_region(dev->iobase, PCM3724_SIZE);
+       comedi_legacy_detach(dev);
 }
 
 static struct comedi_driver pcm3724_driver = {
index 01e81c8fa853eba83101e36553e581c445f20043..0bb9e8e42456776fc81351160deb77b71b0e7575 100644 (file)
@@ -137,8 +137,7 @@ static void pcmad_detach(struct comedi_device *dev)
 {
        if (dev->irq)
                free_irq(dev->irq, dev);
-       if (dev->iobase)
-               release_region(dev->iobase, PCMAD_SIZE);
+       comedi_legacy_detach(dev);
 }
 
 static const struct pcmad_board_struct pcmad_boards[] = {
index 9166af996f1618a5c81c5f7c8b94fd3ca9b77881..d06e18191281e0895e3ad2abbd515a193bdb19ab 100644 (file)
@@ -1206,14 +1206,13 @@ static void pcmmio_detach(struct comedi_device *dev)
        struct pcmmio_private *devpriv = dev->private;
        int i;
 
-       if (dev->iobase)
-               release_region(dev->iobase, 32);
        for (i = 0; i < MAX_ASICS; ++i) {
                if (devpriv && devpriv->asics[i].irq)
                        free_irq(devpriv->asics[i].irq, dev);
        }
        if (devpriv && devpriv->sprivs)
                kfree(devpriv->sprivs);
+       comedi_legacy_detach(dev);
 }
 
 static struct comedi_driver pcmmio_driver = {
index fc15d48bd30eea826453a208cfe8d0184e18692c..7d5682fc58ff512af907a70add34b9b8e32703ce 100644 (file)
@@ -935,18 +935,16 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
 
 static void pcmuio_detach(struct comedi_device *dev)
 {
-       const struct pcmuio_board *board = comedi_board(dev);
        struct pcmuio_private *devpriv = dev->private;
        int i;
 
-       if (dev->iobase)
-               release_region(dev->iobase, ASIC_IOSIZE * board->num_asics);
        for (i = 0; i < MAX_ASICS; ++i) {
                if (devpriv->asics[i].irq)
                        free_irq(devpriv->asics[i].irq, dev);
        }
        if (devpriv && devpriv->sprivs)
                kfree(devpriv->sprivs);
+       comedi_legacy_detach(dev);
 }
 
 static const struct pcmuio_board pcmuio_boards[] = {