[PATCH v2 10/11] staging: comedi: drivers: use comedi_legacy_detach()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use comedi_legacy_detach() to release the I/O region requested
by these drivers.

Signed-off-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx>
Cc: Ian Abbott <abbotti@xxxxxxxxx>
Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/staging/comedi/drivers/aio_aio12_8.c    | 3 +--
 drivers/staging/comedi/drivers/amplc_pc236.c    | 3 +--
 drivers/staging/comedi/drivers/c6xdigio.c       | 3 +--
 drivers/staging/comedi/drivers/comedi_parport.c | 3 +--
 drivers/staging/comedi/drivers/das08_isa.c      | 5 +----
 drivers/staging/comedi/drivers/das6402.c        | 3 +--
 drivers/staging/comedi/drivers/das800.c         | 5 ++---
 drivers/staging/comedi/drivers/dmm32at.c        | 3 +--
 drivers/staging/comedi/drivers/dt2811.c         | 3 +--
 drivers/staging/comedi/drivers/dt2814.c         | 3 +--
 drivers/staging/comedi/drivers/dt282x.c         | 3 +--
 drivers/staging/comedi/drivers/ni_at_a2150.c    | 5 ++---
 drivers/staging/comedi/drivers/ni_atmio.c       | 3 +--
 drivers/staging/comedi/drivers/ni_atmio16d.c    | 3 +--
 drivers/staging/comedi/drivers/ni_labpc.c       | 4 ++--
 drivers/staging/comedi/drivers/pcl711.c         | 3 +--
 drivers/staging/comedi/drivers/pcl724.c         | 3 +--
 drivers/staging/comedi/drivers/pcl726.c         | 5 +----
 drivers/staging/comedi/drivers/pcl816.c         | 4 +---
 drivers/staging/comedi/drivers/pcl818.c         | 3 +--
 drivers/staging/comedi/drivers/pcm3724.c        | 3 +--
 drivers/staging/comedi/drivers/pcmad.c          | 3 +--
 drivers/staging/comedi/drivers/pcmmio.c         | 3 +--
 drivers/staging/comedi/drivers/pcmuio.c         | 4 +---
 24 files changed, 27 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/comedi/drivers/aio_aio12_8.c b/drivers/staging/comedi/drivers/aio_aio12_8.c
index a3ca5c6..e2dc08a 100644
--- a/drivers/staging/comedi/drivers/aio_aio12_8.c
+++ b/drivers/staging/comedi/drivers/aio_aio12_8.c
@@ -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 = {
diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c
index 0f1a0f8..cb73c36 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -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);
diff --git a/drivers/staging/comedi/drivers/c6xdigio.c b/drivers/staging/comedi/drivers/c6xdigio.c
index 0279e06..92376dc 100644
--- a/drivers/staging/comedi/drivers/c6xdigio.c
+++ b/drivers/staging/comedi/drivers/c6xdigio.c
@@ -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);
 }
 
diff --git a/drivers/staging/comedi/drivers/comedi_parport.c b/drivers/staging/comedi/drivers/comedi_parport.c
index f9dc1e8..1355e75 100644
--- a/drivers/staging/comedi/drivers/comedi_parport.c
+++ b/drivers/staging/comedi/drivers/comedi_parport.c
@@ -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 = {
diff --git a/drivers/staging/comedi/drivers/das08_isa.c b/drivers/staging/comedi/drivers/das08_isa.c
index a6de825..f09f696 100644
--- a/drivers/staging/comedi/drivers/das08_isa.c
+++ b/drivers/staging/comedi/drivers/das08_isa.c
@@ -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 = {
diff --git a/drivers/staging/comedi/drivers/das6402.c b/drivers/staging/comedi/drivers/das6402.c
index 431dd22..b4c26fb 100644
--- a/drivers/staging/comedi/drivers/das6402.c
+++ b/drivers/staging/comedi/drivers/das6402.c
@@ -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 = {
diff --git a/drivers/staging/comedi/drivers/das800.c b/drivers/staging/comedi/drivers/das800.c
index d56584d..3456d9e 100644
--- a/drivers/staging/comedi/drivers/das800.c
+++ b/drivers/staging/comedi/drivers/das800.c
@@ -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)
 {
diff --git a/drivers/staging/comedi/drivers/dmm32at.c b/drivers/staging/comedi/drivers/dmm32at.c
index 7621cdf..507ca8e 100644
--- a/drivers/staging/comedi/drivers/dmm32at.c
+++ b/drivers/staging/comedi/drivers/dmm32at.c
@@ -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 = {
diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c
index 16cbd54..e878059 100644
--- a/drivers/staging/comedi/drivers/dt2811.c
+++ b/drivers/staging/comedi/drivers/dt2811.c
@@ -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[] = {
diff --git a/drivers/staging/comedi/drivers/dt2814.c b/drivers/staging/comedi/drivers/dt2814.c
index 46dca8e..e47822e 100644
--- a/drivers/staging/comedi/drivers/dt2814.c
+++ b/drivers/staging/comedi/drivers/dt2814.c
@@ -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 = {
diff --git a/drivers/staging/comedi/drivers/dt282x.c b/drivers/staging/comedi/drivers/dt282x.c
index 0661045..6badbd4 100644
--- a/drivers/staging/comedi/drivers/dt282x.c
+++ b/drivers/staging/comedi/drivers/dt282x.c
@@ -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[] = {
diff --git a/drivers/staging/comedi/drivers/ni_at_a2150.c b/drivers/staging/comedi/drivers/ni_at_a2150.c
index 8cd6604..3079615 100644
--- a/drivers/staging/comedi/drivers/ni_at_a2150.c
+++ b/drivers/staging/comedi/drivers/ni_at_a2150.c
@@ -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 = {
diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c
index 02e5ae1..d439f6b 100644
--- a/drivers/staging/comedi/drivers/ni_atmio.c
+++ b/drivers/staging/comedi/drivers/ni_atmio.c
@@ -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);
 }
diff --git a/drivers/staging/comedi/drivers/ni_atmio16d.c b/drivers/staging/comedi/drivers/ni_atmio16d.c
index 4fb36cd..1414970 100644
--- a/drivers/staging/comedi/drivers/ni_atmio16d.c
+++ b/drivers/staging/comedi/drivers/ni_atmio16d.c
@@ -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[] = {
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index d48511f..1137281 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -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);
diff --git a/drivers/staging/comedi/drivers/pcl711.c b/drivers/staging/comedi/drivers/pcl711.c
index 4610aa8..92fb486 100644
--- a/drivers/staging/comedi/drivers/pcl711.c
+++ b/drivers/staging/comedi/drivers/pcl711.c
@@ -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[] = {
diff --git a/drivers/staging/comedi/drivers/pcl724.c b/drivers/staging/comedi/drivers/pcl724.c
index 0f5a482..3a3e4f5 100644
--- a/drivers/staging/comedi/drivers/pcl724.c
+++ b/drivers/staging/comedi/drivers/pcl724.c
@@ -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[] = {
diff --git a/drivers/staging/comedi/drivers/pcl726.c b/drivers/staging/comedi/drivers/pcl726.c
index cc35ff5..5d0c4fe 100644
--- a/drivers/staging/comedi/drivers/pcl726.c
+++ b/drivers/staging/comedi/drivers/pcl726.c
@@ -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 = {
diff --git a/drivers/staging/comedi/drivers/pcl816.c b/drivers/staging/comedi/drivers/pcl816.c
index 2fd688a..4ea6fec 100644
--- a/drivers/staging/comedi/drivers/pcl816.c
+++ b/drivers/staging/comedi/drivers/pcl816.c
@@ -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[] = {
diff --git a/drivers/staging/comedi/drivers/pcl818.c b/drivers/staging/comedi/drivers/pcl818.c
index 8a1a8a5..cd76da6 100644
--- a/drivers/staging/comedi/drivers/pcl818.c
+++ b/drivers/staging/comedi/drivers/pcl818.c
@@ -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[] = {
diff --git a/drivers/staging/comedi/drivers/pcm3724.c b/drivers/staging/comedi/drivers/pcm3724.c
index 19742d1..4ef0df3 100644
--- a/drivers/staging/comedi/drivers/pcm3724.c
+++ b/drivers/staging/comedi/drivers/pcm3724.c
@@ -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 = {
diff --git a/drivers/staging/comedi/drivers/pcmad.c b/drivers/staging/comedi/drivers/pcmad.c
index 01e81c8..0bb9e8e 100644
--- a/drivers/staging/comedi/drivers/pcmad.c
+++ b/drivers/staging/comedi/drivers/pcmad.c
@@ -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[] = {
diff --git a/drivers/staging/comedi/drivers/pcmmio.c b/drivers/staging/comedi/drivers/pcmmio.c
index 9166af9..d06e181 100644
--- a/drivers/staging/comedi/drivers/pcmmio.c
+++ b/drivers/staging/comedi/drivers/pcmmio.c
@@ -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 = {
diff --git a/drivers/staging/comedi/drivers/pcmuio.c b/drivers/staging/comedi/drivers/pcmuio.c
index fc15d48..7d5682f 100644
--- a/drivers/staging/comedi/drivers/pcmuio.c
+++ b/drivers/staging/comedi/drivers/pcmuio.c
@@ -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[] = {
-- 
1.8.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux