summaryrefslogtreecommitdiff
path: root/drivers/staging
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/comedi/comedi_pci.c14
-rw-r--r--drivers/staging/comedi/comedidev.h4
-rw-r--r--drivers/staging/comedi/drivers/8255_pci.c10
-rw-r--r--drivers/staging/comedi/drivers/addi-data/addi_common.c6
-rw-r--r--drivers/staging/comedi/drivers/addi_apci_1032.c7
-rw-r--r--drivers/staging/comedi/drivers/addi_apci_1516.c5
-rw-r--r--drivers/staging/comedi/drivers/addi_apci_16xx.c12
-rw-r--r--drivers/staging/comedi/drivers/addi_apci_1710.c7
-rw-r--r--drivers/staging/comedi/drivers/addi_apci_2032.c7
-rw-r--r--drivers/staging/comedi/drivers/addi_apci_2200.c7
-rw-r--r--drivers/staging/comedi/drivers/addi_apci_3120.c6
-rw-r--r--drivers/staging/comedi/drivers/addi_apci_3501.c7
-rw-r--r--drivers/staging/comedi/drivers/adl_pci6208.c12
-rw-r--r--drivers/staging/comedi/drivers/adl_pci7x3x.c12
-rw-r--r--drivers/staging/comedi/drivers/adl_pci8164.c12
-rw-r--r--drivers/staging/comedi/drivers/adl_pci9111.c7
-rw-r--r--drivers/staging/comedi/drivers/adl_pci9118.c7
-rw-r--r--drivers/staging/comedi/drivers/adv_pci1710.c7
-rw-r--r--drivers/staging/comedi/drivers/adv_pci1723.c11
-rw-r--r--drivers/staging/comedi/drivers/adv_pci1724.c12
-rw-r--r--drivers/staging/comedi/drivers/adv_pci_dio.c6
-rw-r--r--drivers/staging/comedi/drivers/amplc_dio200.c11
-rw-r--r--drivers/staging/comedi/drivers/amplc_pc236.c6
-rw-r--r--drivers/staging/comedi/drivers/amplc_pc263.c6
-rw-r--r--drivers/staging/comedi/drivers/amplc_pci224.c6
-rw-r--r--drivers/staging/comedi/drivers/amplc_pci230.c6
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidas.c7
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidas64.c5
-rw-r--r--drivers/staging/comedi/drivers/cb_pcidda.c7
-rw-r--r--drivers/staging/comedi/drivers/cb_pcimdas.c7
-rw-r--r--drivers/staging/comedi/drivers/cb_pcimdda.c7
-rw-r--r--drivers/staging/comedi/drivers/contec_pci_dio.c12
-rw-r--r--drivers/staging/comedi/drivers/daqboard2000.c7
-rw-r--r--drivers/staging/comedi/drivers/das08_pci.c5
-rw-r--r--drivers/staging/comedi/drivers/dt3000.c6
-rw-r--r--drivers/staging/comedi/drivers/dyna_pci10xx.c6
-rw-r--r--drivers/staging/comedi/drivers/gsc_hpdi.c3
-rw-r--r--drivers/staging/comedi/drivers/icp_multi.c6
-rw-r--r--drivers/staging/comedi/drivers/jr3_pci.c4
-rw-r--r--drivers/staging/comedi/drivers/ke_counter.c12
-rw-r--r--drivers/staging/comedi/drivers/me4000.c11
-rw-r--r--drivers/staging/comedi/drivers/me_daq.c6
-rw-r--r--drivers/staging/comedi/drivers/mite.c4
-rw-r--r--drivers/staging/comedi/drivers/ni_6527.c2
-rw-r--r--drivers/staging/comedi/drivers/ni_65xx.c2
-rw-r--r--drivers/staging/comedi/drivers/ni_660x.c2
-rw-r--r--drivers/staging/comedi/drivers/ni_670x.c2
-rw-r--r--drivers/staging/comedi/drivers/ni_labpc.c2
-rw-r--r--drivers/staging/comedi/drivers/ni_pcidio.c2
-rw-r--r--drivers/staging/comedi/drivers/ni_pcimio.c2
-rw-r--r--drivers/staging/comedi/drivers/rtd520.c6
-rw-r--r--drivers/staging/comedi/drivers/s626.c6
-rw-r--r--drivers/staging/comedi/drivers/skel.c4
53 files changed, 82 insertions, 276 deletions
diff --git a/drivers/staging/comedi/comedi_pci.c b/drivers/staging/comedi/comedi_pci.c
index bf5095601e00..bee012c1e6a2 100644
--- a/drivers/staging/comedi/comedi_pci.c
+++ b/drivers/staging/comedi/comedi_pci.c
@@ -57,14 +57,16 @@ EXPORT_SYMBOL_GPL(comedi_pci_enable);
/**
* comedi_pci_disable() - Release the regions and disable the PCI device.
- * @pcidev: pci_dev struct
- *
- * This must be matched with a previous successful call to comedi_pci_enable().
+ * @dev: comedi_device struct
*/
-void comedi_pci_disable(struct pci_dev *pcidev)
+void comedi_pci_disable(struct comedi_device *dev)
{
- pci_release_regions(pcidev);
- pci_disable_device(pcidev);
+ struct pci_dev *pcidev = comedi_to_pci_dev(dev);
+
+ if (pcidev && dev->iobase) {
+ pci_release_regions(pcidev);
+ pci_disable_device(pcidev);
+ }
}
EXPORT_SYMBOL_GPL(comedi_pci_disable);
diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h
index b8e5d091fff8..9846c2ecc916 100644
--- a/drivers/staging/comedi/comedidev.h
+++ b/drivers/staging/comedi/comedidev.h
@@ -385,7 +385,7 @@ struct pci_driver;
struct pci_dev *comedi_to_pci_dev(struct comedi_device *);
int comedi_pci_enable(struct pci_dev *, const char *);
-void comedi_pci_disable(struct pci_dev *);
+void comedi_pci_disable(struct comedi_device *);
int comedi_pci_auto_config(struct pci_dev *, struct comedi_driver *,
unsigned long context);
@@ -426,7 +426,7 @@ static inline int comedi_pci_enable(struct pci_dev *dev, const char *name)
return -ENOSYS;
}
-static inline void comedi_pci_disable(struct pci_dev *dev)
+static inline void comedi_pci_disable(struct comedi_device *dev)
{
}
diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c
index 7e25500cd996..a546dff61925 100644
--- a/drivers/staging/comedi/drivers/8255_pci.c
+++ b/drivers/staging/comedi/drivers/8255_pci.c
@@ -247,7 +247,6 @@ static int pci_8255_auto_attach(struct comedi_device *dev,
static void pci_8255_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
const struct pci_8255_boardinfo *board = comedi_board(dev);
struct pci_8255_private *devpriv = dev->private;
struct comedi_subdevice *s;
@@ -261,12 +260,9 @@ static void pci_8255_detach(struct comedi_device *dev)
subdev_8255_cleanup(dev, s);
}
}
- if (pcidev) {
- if (devpriv->mmio_base)
- iounmap(devpriv->mmio_base);
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ if (devpriv->mmio_base)
+ iounmap(devpriv->mmio_base);
+ comedi_pci_disable(dev);
}
static struct comedi_driver pci_8255_driver = {
diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c
index 3140880948e1..704a56eec6b7 100644
--- a/drivers/staging/comedi/drivers/addi-data/addi_common.c
+++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c
@@ -317,7 +317,6 @@ static int addi_auto_attach(struct comedi_device *dev,
static void i_ADDI_Detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct addi_private *devpriv = dev->private;
if (devpriv) {
@@ -328,8 +327,5 @@ static void i_ADDI_Detach(struct comedi_device *dev)
if (devpriv->dw_AiBase)
iounmap(devpriv->dw_AiBase);
}
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
diff --git a/drivers/staging/comedi/drivers/addi_apci_1032.c b/drivers/staging/comedi/drivers/addi_apci_1032.c
index fdd053c61a63..4da6e8b14dc1 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1032.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1032.c
@@ -353,16 +353,11 @@ static int apci1032_auto_attach(struct comedi_device *dev,
static void apci1032_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->iobase)
apci1032_reset(dev);
if (dev->irq)
free_irq(dev->irq, dev);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver apci1032_driver = {
diff --git a/drivers/staging/comedi/drivers/addi_apci_1516.c b/drivers/staging/comedi/drivers/addi_apci_1516.c
index 0319315ba9bd..a7e449db4693 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1516.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1516.c
@@ -201,14 +201,11 @@ static int apci1516_auto_attach(struct comedi_device *dev,
static void apci1516_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->iobase)
apci1516_reset(dev);
if (dev->subdevices)
addi_watchdog_cleanup(&dev->subdevices[2]);
- if (dev->iobase)
- comedi_pci_disable(pcidev);
+ comedi_pci_disable(dev);
}
static struct comedi_driver apci1516_driver = {
diff --git a/drivers/staging/comedi/drivers/addi_apci_16xx.c b/drivers/staging/comedi/drivers/addi_apci_16xx.c
index 8aca57f8590a..e2f9357d4c35 100644
--- a/drivers/staging/comedi/drivers/addi_apci_16xx.c
+++ b/drivers/staging/comedi/drivers/addi_apci_16xx.c
@@ -184,21 +184,11 @@ static int apci16xx_auto_attach(struct comedi_device *dev,
return 0;
}
-static void apci16xx_detach(struct comedi_device *dev)
-{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
-}
-
static struct comedi_driver apci16xx_driver = {
.driver_name = "addi_apci_16xx",
.module = THIS_MODULE,
.auto_attach = apci16xx_auto_attach,
- .detach = apci16xx_detach,
+ .detach = comedi_pci_disable,
};
static int apci16xx_pci_probe(struct pci_dev *dev,
diff --git a/drivers/staging/comedi/drivers/addi_apci_1710.c b/drivers/staging/comedi/drivers/addi_apci_1710.c
index f654eb03473a..05e1b9c391e6 100644
--- a/drivers/staging/comedi/drivers/addi_apci_1710.c
+++ b/drivers/staging/comedi/drivers/addi_apci_1710.c
@@ -73,16 +73,11 @@ static int apci1710_auto_attach(struct comedi_device *dev,
static void apci1710_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->iobase)
i_APCI1710_Reset(dev);
if (dev->irq)
free_irq(dev->irq, dev);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver apci1710_driver = {
diff --git a/drivers/staging/comedi/drivers/addi_apci_2032.c b/drivers/staging/comedi/drivers/addi_apci_2032.c
index 4a33b3502f40..6e4ee0ae67aa 100644
--- a/drivers/staging/comedi/drivers/addi_apci_2032.c
+++ b/drivers/staging/comedi/drivers/addi_apci_2032.c
@@ -350,8 +350,6 @@ static int apci2032_auto_attach(struct comedi_device *dev,
static void apci2032_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->iobase)
apci2032_reset(dev);
if (dev->irq)
@@ -360,10 +358,7 @@ static void apci2032_detach(struct comedi_device *dev)
kfree(dev->read_subdev->private);
if (dev->subdevices)
addi_watchdog_cleanup(&dev->subdevices[1]);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver apci2032_driver = {
diff --git a/drivers/staging/comedi/drivers/addi_apci_2200.c b/drivers/staging/comedi/drivers/addi_apci_2200.c
index 48afa2316497..aea0abb1a0af 100644
--- a/drivers/staging/comedi/drivers/addi_apci_2200.c
+++ b/drivers/staging/comedi/drivers/addi_apci_2200.c
@@ -130,16 +130,11 @@ static int apci2200_auto_attach(struct comedi_device *dev,
static void apci2200_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->iobase)
apci2200_reset(dev);
if (dev->subdevices)
addi_watchdog_cleanup(&dev->subdevices[2]);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver apci2200_driver = {
diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c
index 07bcb388fc5f..056153157e51 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3120.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3120.c
@@ -203,7 +203,6 @@ static int apci3120_auto_attach(struct comedi_device *dev,
static void apci3120_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct addi_private *devpriv = dev->private;
if (devpriv) {
@@ -222,10 +221,7 @@ static void apci3120_detach(struct comedi_device *dev)
devpriv->ui_DmaBufferPages[1]);
}
}
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver apci3120_driver = {
diff --git a/drivers/staging/comedi/drivers/addi_apci_3501.c b/drivers/staging/comedi/drivers/addi_apci_3501.c
index ecd54ea6f8de..8bd3d72df0a6 100644
--- a/drivers/staging/comedi/drivers/addi_apci_3501.c
+++ b/drivers/staging/comedi/drivers/addi_apci_3501.c
@@ -423,16 +423,11 @@ static int apci3501_auto_attach(struct comedi_device *dev,
static void apci3501_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->iobase)
apci3501_reset(dev);
if (dev->irq)
free_irq(dev->irq, dev);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver apci3501_driver = {
diff --git a/drivers/staging/comedi/drivers/adl_pci6208.c b/drivers/staging/comedi/drivers/adl_pci6208.c
index 49f82f48bf09..8939bbdaee5f 100644
--- a/drivers/staging/comedi/drivers/adl_pci6208.c
+++ b/drivers/staging/comedi/drivers/adl_pci6208.c
@@ -233,21 +233,11 @@ static int pci6208_auto_attach(struct comedi_device *dev,
return 0;
}
-static void pci6208_detach(struct comedi_device *dev)
-{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
-}
-
static struct comedi_driver adl_pci6208_driver = {
.driver_name = "adl_pci6208",
.module = THIS_MODULE,
.auto_attach = pci6208_auto_attach,
- .detach = pci6208_detach,
+ .detach = comedi_pci_disable,
};
static int adl_pci6208_pci_probe(struct pci_dev *dev,
diff --git a/drivers/staging/comedi/drivers/adl_pci7x3x.c b/drivers/staging/comedi/drivers/adl_pci7x3x.c
index 70f8c93ef7ad..bd2e58415d77 100644
--- a/drivers/staging/comedi/drivers/adl_pci7x3x.c
+++ b/drivers/staging/comedi/drivers/adl_pci7x3x.c
@@ -259,21 +259,11 @@ static int adl_pci7x3x_auto_attach(struct comedi_device *dev,
return 0;
}
-static void adl_pci7x3x_detach(struct comedi_device *dev)
-{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
-}
-
static struct comedi_driver adl_pci7x3x_driver = {
.driver_name = "adl_pci7x3x",
.module = THIS_MODULE,
.auto_attach = adl_pci7x3x_auto_attach,
- .detach = adl_pci7x3x_detach,
+ .detach = comedi_pci_disable,
};
static int adl_pci7x3x_pci_probe(struct pci_dev *dev,
diff --git a/drivers/staging/comedi/drivers/adl_pci8164.c b/drivers/staging/comedi/drivers/adl_pci8164.c
index de5cac052888..008f89aea4ba 100644
--- a/drivers/staging/comedi/drivers/adl_pci8164.c
+++ b/drivers/staging/comedi/drivers/adl_pci8164.c
@@ -136,21 +136,11 @@ static int adl_pci8164_auto_attach(struct comedi_device *dev,
return 0;
}
-static void adl_pci8164_detach(struct comedi_device *dev)
-{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
-}
-
static struct comedi_driver adl_pci8164_driver = {
.driver_name = "adl_pci8164",
.module = THIS_MODULE,
.auto_attach = adl_pci8164_auto_attach,
- .detach = adl_pci8164_detach,
+ .detach = comedi_pci_disable,
};
static int adl_pci8164_pci_probe(struct pci_dev *dev,
diff --git a/drivers/staging/comedi/drivers/adl_pci9111.c b/drivers/staging/comedi/drivers/adl_pci9111.c
index 8680cf18b7de..ee45ee8c03c4 100644
--- a/drivers/staging/comedi/drivers/adl_pci9111.c
+++ b/drivers/staging/comedi/drivers/adl_pci9111.c
@@ -939,16 +939,11 @@ static int pci9111_auto_attach(struct comedi_device *dev,
static void pci9111_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->iobase)
pci9111_reset(dev);
if (dev->irq != 0)
free_irq(dev->irq, dev);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver adl_pci9111_driver = {
diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c b/drivers/staging/comedi/drivers/adl_pci9118.c
index a0277a83115d..2bf00e834540 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -2202,12 +2202,9 @@ static void pci9118_detach(struct comedi_device *dev)
free_pages((unsigned long)devpriv->dmabuf_virt[1],
devpriv->dmabuf_pages[1]);
}
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
-
+ comedi_pci_disable(dev);
+ if (pcidev)
pci_dev_put(pcidev);
- }
}
static struct comedi_driver adl_pci9118_driver = {
diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c b/drivers/staging/comedi/drivers/adv_pci1710.c
index 2f6c2d72986d..af302fe3f5cb 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -1372,16 +1372,11 @@ static int pci1710_auto_attach(struct comedi_device *dev,
static void pci1710_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->iobase)
pci1710_reset(dev);
if (dev->irq)
free_irq(dev->irq, dev);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver adv_pci1710_driver = {
diff --git a/drivers/staging/comedi/drivers/adv_pci1723.c b/drivers/staging/comedi/drivers/adv_pci1723.c
index bd95b1d4338a..25f4cba5a75b 100644
--- a/drivers/staging/comedi/drivers/adv_pci1723.c
+++ b/drivers/staging/comedi/drivers/adv_pci1723.c
@@ -306,14 +306,9 @@ static int pci1723_auto_attach(struct comedi_device *dev,
static void pci1723_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
- if (pcidev) {
- if (dev->iobase) {
- pci1723_reset(dev);
- comedi_pci_disable(pcidev);
- }
- }
+ if (dev->iobase)
+ pci1723_reset(dev);
+ comedi_pci_disable(dev);
}
static struct comedi_driver adv_pci1723_driver = {
diff --git a/drivers/staging/comedi/drivers/adv_pci1724.c b/drivers/staging/comedi/drivers/adv_pci1724.c
index f448e4db4d95..c799308adfb4 100644
--- a/drivers/staging/comedi/drivers/adv_pci1724.c
+++ b/drivers/staging/comedi/drivers/adv_pci1724.c
@@ -377,21 +377,11 @@ static int adv_pci1724_auto_attach(struct comedi_device *dev,
return 0;
}
-static void adv_pci1724_detach(struct comedi_device *dev)
-{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
- if (pcidev && dev->iobase) {
- comedi_pci_disable(pcidev);
- dev_info(dev->class_dev, "detached\n");
- }
-}
-
static struct comedi_driver adv_pci1724_driver = {
.driver_name = "adv_pci1724",
.module = THIS_MODULE,
.auto_attach = adv_pci1724_auto_attach,
- .detach = adv_pci1724_detach,
+ .detach = comedi_pci_disable,
};
static int adv_pci1724_pci_probe(struct pci_dev *dev,
diff --git a/drivers/staging/comedi/drivers/adv_pci_dio.c b/drivers/staging/comedi/drivers/adv_pci_dio.c
index 52b6d0264d34..79f72d6d7de1 100644
--- a/drivers/staging/comedi/drivers/adv_pci_dio.c
+++ b/drivers/staging/comedi/drivers/adv_pci_dio.c
@@ -1165,7 +1165,6 @@ static int pci_dio_auto_attach(struct comedi_device *dev,
static void pci_dio_detach(struct comedi_device *dev)
{
struct pci_dio_private *devpriv = dev->private;
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct comedi_subdevice *s;
int i;
@@ -1181,10 +1180,7 @@ static void pci_dio_detach(struct comedi_device *dev)
s->private = NULL;
}
}
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver adv_pci_dio_driver = {
diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c
index 82f80d563fbe..d13a6dddcd09 100644
--- a/drivers/staging/comedi/drivers/amplc_dio200.c
+++ b/drivers/staging/comedi/drivers/amplc_dio200.c
@@ -2029,14 +2029,9 @@ static void dio200_detach(struct comedi_device *dev)
release_region(devpriv->io.u.iobase,
thisboard->mainsize);
} else if (is_pci_board(thisboard)) {
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
- if (pcidev) {
- if (devpriv->io.regtype != no_regtype) {
- if (devpriv->io.regtype == mmio_regtype)
- iounmap(devpriv->io.u.membase);
- comedi_pci_disable(pcidev);
- }
- }
+ if (devpriv->io.regtype == mmio_regtype)
+ iounmap(devpriv->io.u.membase);
+ comedi_pci_disable(dev);
}
}
diff --git a/drivers/staging/comedi/drivers/amplc_pc236.c b/drivers/staging/comedi/drivers/amplc_pc236.c
index b6bba4d15a5a..45168488503d 100644
--- a/drivers/staging/comedi/drivers/amplc_pc236.c
+++ b/drivers/staging/comedi/drivers/amplc_pc236.c
@@ -576,11 +576,9 @@ static void pc236_detach(struct comedi_device *dev)
release_region(dev->iobase, PC236_IO_SIZE);
} else if (is_pci_board(thisboard)) {
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
+ comedi_pci_disable(dev);
+ if (pcidev)
pci_dev_put(pcidev);
- }
}
}
diff --git a/drivers/staging/comedi/drivers/amplc_pc263.c b/drivers/staging/comedi/drivers/amplc_pc263.c
index e61d55679a77..d825414994b8 100644
--- a/drivers/staging/comedi/drivers/amplc_pc263.c
+++ b/drivers/staging/comedi/drivers/amplc_pc263.c
@@ -335,11 +335,9 @@ static void pc263_detach(struct comedi_device *dev)
release_region(dev->iobase, PC263_IO_SIZE);
} else if (is_pci_board(thisboard)) {
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
+ 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 4a56468cb7ba..3d5c1332eb34 100644
--- a/drivers/staging/comedi/drivers/amplc_pci224.c
+++ b/drivers/staging/comedi/drivers/amplc_pci224.c
@@ -1488,11 +1488,9 @@ static void pci224_detach(struct comedi_device *dev)
kfree(devpriv->ao_scan_vals);
kfree(devpriv->ao_scan_order);
}
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
+ comedi_pci_disable(dev);
+ if (pcidev)
pci_dev_put(pcidev);
- }
}
static struct comedi_driver amplc_pci224_driver = {
diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c
index 70074b512130..1bfe893b4cb2 100644
--- a/drivers/staging/comedi/drivers/amplc_pci230.c
+++ b/drivers/staging/comedi/drivers/amplc_pci230.c
@@ -2840,11 +2840,9 @@ static void pci230_detach(struct comedi_device *dev)
subdev_8255_cleanup(dev, &dev->subdevices[2]);
if (dev->irq)
free_irq(dev->irq, dev);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
+ comedi_pci_disable(dev);
+ if (pcidev)
pci_dev_put(pcidev);
- }
}
static struct comedi_driver amplc_pci230_driver = {
diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c
index 1f9316996951..04aa8d948a8b 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas.c
@@ -1458,6 +1458,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev,
ret = comedi_pci_enable(pcidev, dev->board_name);
if (ret)
return ret;
+ dev->iobase = 1;
devpriv->s5933_config = pci_resource_start(pcidev, 0);
devpriv->control_status = pci_resource_start(pcidev, 1);
@@ -1599,7 +1600,6 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev,
static void cb_pcidas_detach(struct comedi_device *dev)
{
struct cb_pcidas_private *devpriv = dev->private;
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
if (devpriv) {
if (devpriv->s5933_config) {
@@ -1611,10 +1611,7 @@ static void cb_pcidas_detach(struct comedi_device *dev)
free_irq(dev->irq, dev);
if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[2]);
- if (pcidev) {
- if (devpriv->s5933_config)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver cb_pcidas_driver = {
diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c
index e61cf71d46ef..15a97212b158 100644
--- a/drivers/staging/comedi/drivers/cb_pcidas64.c
+++ b/drivers/staging/comedi/drivers/cb_pcidas64.c
@@ -4194,10 +4194,7 @@ static void detach(struct comedi_device *dev)
}
if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[4]);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver cb_pcidas64_driver = {
diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c
index 54cdb2728a81..aff16171ca93 100644
--- a/drivers/staging/comedi/drivers/cb_pcidda.c
+++ b/drivers/staging/comedi/drivers/cb_pcidda.c
@@ -399,16 +399,11 @@ static int cb_pcidda_auto_attach(struct comedi_device *dev,
static void cb_pcidda_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->subdevices) {
subdev_8255_cleanup(dev, &dev->subdevices[1]);
subdev_8255_cleanup(dev, &dev->subdevices[2]);
}
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver cb_pcidda_driver = {
diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c
index 7d456ad2aad4..8a8677f2525e 100644
--- a/drivers/staging/comedi/drivers/cb_pcimdas.c
+++ b/drivers/staging/comedi/drivers/cb_pcimdas.c
@@ -277,14 +277,9 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev,
static void cb_pcimdas_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->irq)
free_irq(dev->irq, dev);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver cb_pcimdas_driver = {
diff --git a/drivers/staging/comedi/drivers/cb_pcimdda.c b/drivers/staging/comedi/drivers/cb_pcimdda.c
index 5db4f4ada463..7b8adec5e7b9 100644
--- a/drivers/staging/comedi/drivers/cb_pcimdda.c
+++ b/drivers/staging/comedi/drivers/cb_pcimdda.c
@@ -201,14 +201,9 @@ static int cb_pcimdda_auto_attach(struct comedi_device *dev,
static void cb_pcimdda_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->subdevices)
subdev_8255_cleanup(dev, &dev->subdevices[1]);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver cb_pcimdda_driver = {
diff --git a/drivers/staging/comedi/drivers/contec_pci_dio.c b/drivers/staging/comedi/drivers/contec_pci_dio.c
index d6597445aae8..b8c56a60cda9 100644
--- a/drivers/staging/comedi/drivers/contec_pci_dio.c
+++ b/drivers/staging/comedi/drivers/contec_pci_dio.c
@@ -109,21 +109,11 @@ static int contec_auto_attach(struct comedi_device *dev,
return 0;
}
-static void contec_detach(struct comedi_device *dev)
-{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
-}
-
static struct comedi_driver contec_pci_dio_driver = {
.driver_name = "contec_pci_dio",
.module = THIS_MODULE,
.auto_attach = contec_auto_attach,
- .detach = contec_detach,
+ .detach = comedi_pci_disable,
};
static int contec_pci_dio_pci_probe(struct pci_dev *dev,
diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c
index 42e13e30d502..077f9a5eb7c8 100644
--- a/drivers/staging/comedi/drivers/daqboard2000.c
+++ b/drivers/staging/comedi/drivers/daqboard2000.c
@@ -767,7 +767,6 @@ static int daqboard2000_auto_attach(struct comedi_device *dev,
static void daqboard2000_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct daqboard2000_private *devpriv = dev->private;
if (dev->subdevices)
@@ -780,11 +779,7 @@ static void daqboard2000_detach(struct comedi_device *dev)
if (devpriv->plx)
iounmap(devpriv->plx);
}
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- pci_dev_put(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver daqboard2000_driver = {
diff --git a/drivers/staging/comedi/drivers/das08_pci.c b/drivers/staging/comedi/drivers/das08_pci.c
index a56cee7f86dd..c64fb2775b8c 100644
--- a/drivers/staging/comedi/drivers/das08_pci.c
+++ b/drivers/staging/comedi/drivers/das08_pci.c
@@ -81,11 +81,8 @@ static int das08_pci_auto_attach(struct comedi_device *dev,
static void das08_pci_detach(struct comedi_device *dev)
{
- struct pci_dev *pdev = comedi_to_pci_dev(dev);
-
das08_common_detach(dev);
- if (dev->iobase)
- comedi_pci_disable(pdev);
+ comedi_pci_disable(dev);
}
static struct comedi_driver das08_pci_comedi_driver = {
diff --git a/drivers/staging/comedi/drivers/dt3000.c b/drivers/staging/comedi/drivers/dt3000.c
index 5726d56346c8..296c5205ac9f 100644
--- a/drivers/staging/comedi/drivers/dt3000.c
+++ b/drivers/staging/comedi/drivers/dt3000.c
@@ -814,7 +814,6 @@ static int dt3000_auto_attach(struct comedi_device *dev,
static void dt3000_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct dt3k_private *devpriv = dev->private;
if (dev->irq)
@@ -823,10 +822,7 @@ static void dt3000_detach(struct comedi_device *dev)
if (devpriv->io_addr)
iounmap(devpriv->io_addr);
}
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver dt3000_driver = {
diff --git a/drivers/staging/comedi/drivers/dyna_pci10xx.c b/drivers/staging/comedi/drivers/dyna_pci10xx.c
index 58ff129a8339..9f83dfbcf295 100644
--- a/drivers/staging/comedi/drivers/dyna_pci10xx.c
+++ b/drivers/staging/comedi/drivers/dyna_pci10xx.c
@@ -254,15 +254,11 @@ static int dyna_pci10xx_auto_attach(struct comedi_device *dev,
static void dyna_pci10xx_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct dyna_pci10xx_private *devpriv = dev->private;
if (devpriv)
mutex_destroy(&devpriv->mutex);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver dyna_pci10xx_driver = {
diff --git a/drivers/staging/comedi/drivers/gsc_hpdi.c b/drivers/staging/comedi/drivers/gsc_hpdi.c
index a18d897606f8..f0e92143ac89 100644
--- a/drivers/staging/comedi/drivers/gsc_hpdi.c
+++ b/drivers/staging/comedi/drivers/gsc_hpdi.c
@@ -596,9 +596,8 @@ static void hpdi_detach(struct comedi_device *dev)
NUM_DMA_DESCRIPTORS,
devpriv->dma_desc,
devpriv->dma_desc_phys_addr);
- if (dev->iobase)
- comedi_pci_disable(pcidev);
}
+ comedi_pci_disable(dev);
}
static int dio_config_block_size(struct comedi_device *dev, unsigned int *data)
diff --git a/drivers/staging/comedi/drivers/icp_multi.c b/drivers/staging/comedi/drivers/icp_multi.c
index 9a466879e493..65265c3ce3ff 100644
--- a/drivers/staging/comedi/drivers/icp_multi.c
+++ b/drivers/staging/comedi/drivers/icp_multi.c
@@ -594,7 +594,6 @@ static int icp_multi_auto_attach(struct comedi_device *dev,
static void icp_multi_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct icp_multi_private *devpriv = dev->private;
if (devpriv)
@@ -604,10 +603,7 @@ static void icp_multi_detach(struct comedi_device *dev)
free_irq(dev->irq, dev);
if (devpriv && devpriv->io_addr)
iounmap(devpriv->io_addr);
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver icp_multi_driver = {
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c
index aea940121c58..f1ae9a814d8f 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -816,7 +816,6 @@ static int jr3_pci_auto_attach(struct comedi_device *dev,
static void jr3_pci_detach(struct comedi_device *dev)
{
int i;
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct jr3_pci_dev_private *devpriv = dev->private;
if (devpriv) {
@@ -828,9 +827,8 @@ static void jr3_pci_detach(struct comedi_device *dev)
}
if (devpriv->iobase)
iounmap(devpriv->iobase);
- if (dev->iobase)
- comedi_pci_disable(pcidev);
}
+ comedi_pci_disable(dev);
}
static struct comedi_driver jr3_pci_driver = {
diff --git a/drivers/staging/comedi/drivers/ke_counter.c b/drivers/staging/comedi/drivers/ke_counter.c
index ac40e355dff2..74318f204e25 100644
--- a/drivers/staging/comedi/drivers/ke_counter.c
+++ b/drivers/staging/comedi/drivers/ke_counter.c
@@ -131,21 +131,11 @@ static int cnt_auto_attach(struct comedi_device *dev,
return 0;
}
-static void cnt_detach(struct comedi_device *dev)
-{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
-}
-
static struct comedi_driver ke_counter_driver = {
.driver_name = "ke_counter",
.module = THIS_MODULE,
.auto_attach = cnt_auto_attach,
- .detach = cnt_detach,
+ .detach = comedi_pci_disable,
};
static int ke_counter_pci_probe(struct pci_dev *dev,
diff --git a/drivers/staging/comedi/drivers/me4000.c b/drivers/staging/comedi/drivers/me4000.c
index 141a3f7bbf15..6bc1347eaf68 100644
--- a/drivers/staging/comedi/drivers/me4000.c
+++ b/drivers/staging/comedi/drivers/me4000.c
@@ -1697,16 +1697,11 @@ static int me4000_auto_attach(struct comedi_device *dev,
static void me4000_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
-
if (dev->irq)
free_irq(dev->irq, dev);
- if (pcidev) {
- if (dev->iobase) {
- me4000_reset(dev);
- comedi_pci_disable(pcidev);
- }
- }
+ if (dev->iobase)
+ me4000_reset(dev);
+ comedi_pci_disable(dev);
}
static struct comedi_driver me4000_driver = {
diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c
index 55d66d0295e0..8951a673c2d1 100644
--- a/drivers/staging/comedi/drivers/me_daq.c
+++ b/drivers/staging/comedi/drivers/me_daq.c
@@ -580,7 +580,6 @@ static int me_auto_attach(struct comedi_device *dev,
static void me_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct me_private_data *dev_private = dev->private;
if (dev_private) {
@@ -591,10 +590,7 @@ static void me_detach(struct comedi_device *dev)
if (dev_private->plx_regbase)
iounmap(dev_private->plx_regbase);
}
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver me_daq_driver = {
diff --git a/drivers/staging/comedi/drivers/mite.c b/drivers/staging/comedi/drivers/mite.c
index be2c15f84614..5a3b14fb4de1 100644
--- a/drivers/staging/comedi/drivers/mite.c
+++ b/drivers/staging/comedi/drivers/mite.c
@@ -208,10 +208,8 @@ void mite_unsetup(struct mite_struct *mite)
iounmap(mite->daq_io_addr);
mite->daq_io_addr = NULL;
}
- if (mite->mite_phys_addr) {
- comedi_pci_disable(mite->pcidev);
+ if (mite->mite_phys_addr)
mite->mite_phys_addr = 0;
- }
}
EXPORT_SYMBOL(mite_unsetup);
diff --git a/drivers/staging/comedi/drivers/ni_6527.c b/drivers/staging/comedi/drivers/ni_6527.c
index 514d5db92028..194eac63dd3e 100644
--- a/drivers/staging/comedi/drivers/ni_6527.c
+++ b/drivers/staging/comedi/drivers/ni_6527.c
@@ -350,6 +350,7 @@ static int ni6527_auto_attach(struct comedi_device *dev,
dev_err(dev->class_dev, "error setting up mite\n");
return ret;
}
+ dev->iobase = 1;
dev_info(dev->class_dev, "board: %s, ID=0x%02x\n", dev->board_name,
readb(devpriv->mite->daq_io_addr + ID_Register));
@@ -419,6 +420,7 @@ static void ni6527_detach(struct comedi_device *dev)
mite_unsetup(devpriv->mite);
mite_free(devpriv->mite);
}
+ comedi_pci_disable(dev);
}
static struct comedi_driver ni6527_driver = {
diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c
index 74a1e65010cf..b882a5f5b035 100644
--- a/drivers/staging/comedi/drivers/ni_65xx.c
+++ b/drivers/staging/comedi/drivers/ni_65xx.c
@@ -614,6 +614,7 @@ static int ni_65xx_auto_attach(struct comedi_device *dev,
dev_warn(dev->class_dev, "error setting up mite\n");
return ret;
}
+ dev->iobase = 1;
dev->irq = mite_irq(devpriv->mite);
dev_info(dev->class_dev, "board: %s, ID=0x%02x", dev->board_name,
@@ -748,6 +749,7 @@ static void ni_65xx_detach(struct comedi_device *dev)
mite_free(devpriv->mite);
}
}
+ comedi_pci_disable(dev);
}
static struct comedi_driver ni_65xx_driver = {
diff --git a/drivers/staging/comedi/drivers/ni_660x.c b/drivers/staging/comedi/drivers/ni_660x.c
index d2e061a195d0..cc82106af7f0 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -1188,6 +1188,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
dev_warn(dev->class_dev, "error setting up mite\n");
return ret;
}
+ dev->iobase = 1;
ret = ni_660x_alloc_mite_rings(dev);
if (ret < 0)
@@ -1302,6 +1303,7 @@ static void ni_660x_detach(struct comedi_device *dev)
mite_free(devpriv->mite);
}
}
+ comedi_pci_disable(dev);
}
static struct comedi_driver ni_660x_driver = {
diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c
index 0e7b957afbe4..5ec6f829a924 100644
--- a/drivers/staging/comedi/drivers/ni_670x.c
+++ b/drivers/staging/comedi/drivers/ni_670x.c
@@ -222,6 +222,7 @@ static int ni_670x_auto_attach(struct comedi_device *dev,
dev_warn(dev->class_dev, "error setting up mite\n");
return ret;
}
+ dev->iobase = 1;
ret = comedi_alloc_subdevices(dev, 2);
if (ret)
@@ -286,6 +287,7 @@ static void ni_670x_detach(struct comedi_device *dev)
mite_unsetup(devpriv->mite);
mite_free(devpriv->mite);
}
+ comedi_pci_disable(dev);
}
static struct comedi_driver ni_670x_driver = {
diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
index d386c3e2b976..9082eca09499 100644
--- a/drivers/staging/comedi/drivers/ni_labpc.c
+++ b/drivers/staging/comedi/drivers/ni_labpc.c
@@ -722,6 +722,7 @@ static int labpc_auto_attach(struct comedi_device *dev,
ret = mite_setup(devpriv->mite);
if (ret < 0)
return ret;
+ dev->iobase = 1;
iobase = (unsigned long)devpriv->mite->daq_io_addr;
irq = mite_irq(devpriv->mite);
return labpc_common_attach(dev, iobase, irq, 0);
@@ -800,6 +801,7 @@ void labpc_common_detach(struct comedi_device *dev)
mite_unsetup(devpriv->mite);
mite_free(devpriv->mite);
}
+ 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 50e025b07780..8f743751507b 100644
--- a/drivers/staging/comedi/drivers/ni_pcidio.c
+++ b/drivers/staging/comedi/drivers/ni_pcidio.c
@@ -1128,6 +1128,7 @@ static int nidio_auto_attach(struct comedi_device *dev,
dev_warn(dev->class_dev, "error setting up mite\n");
return ret;
}
+ dev->iobase = 1;
devpriv->di_mite_ring = mite_alloc_ring(devpriv->mite);
if (devpriv->di_mite_ring == NULL)
@@ -1202,6 +1203,7 @@ static void nidio_detach(struct comedi_device *dev)
mite_free(devpriv->mite);
}
}
+ comedi_pci_disable(dev);
}
static struct comedi_driver ni_pcidio_driver = {
diff --git a/drivers/staging/comedi/drivers/ni_pcimio.c b/drivers/staging/comedi/drivers/ni_pcimio.c
index 4d1a431edee0..0f18f8dda5fb 100644
--- a/drivers/staging/comedi/drivers/ni_pcimio.c
+++ b/drivers/staging/comedi/drivers/ni_pcimio.c
@@ -1470,6 +1470,7 @@ static void pcimio_detach(struct comedi_device *dev)
mite_free(devpriv->mite);
}
}
+ comedi_pci_disable(dev);
}
static int pcimio_auto_attach(struct comedi_device *dev,
@@ -1513,6 +1514,7 @@ static int pcimio_auto_attach(struct comedi_device *dev,
pr_warn("error setting up mite\n");
return ret;
}
+ dev->iobase = 1;
devpriv->ai_mite_ring = mite_alloc_ring(devpriv->mite);
if (devpriv->ai_mite_ring == NULL)
diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c
index 5ee38b149b51..5b0676817726 100644
--- a/drivers/staging/comedi/drivers/rtd520.c
+++ b/drivers/staging/comedi/drivers/rtd520.c
@@ -1373,7 +1373,6 @@ static int rtd_auto_attach(struct comedi_device *dev,
static void rtd_detach(struct comedi_device *dev)
{
struct rtdPrivate *devpriv = dev->private;
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
if (devpriv) {
/* Shut down any board ops by resetting it */
@@ -1392,10 +1391,7 @@ static void rtd_detach(struct comedi_device *dev)
if (devpriv->lcfg)
iounmap(devpriv->lcfg);
}
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver rtd520_driver = {
diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c
index 4fec6d6a04ab..92338791f4a2 100644
--- a/drivers/staging/comedi/drivers/s626.c
+++ b/drivers/staging/comedi/drivers/s626.c
@@ -2790,7 +2790,6 @@ static int s626_auto_attach(struct comedi_device *dev,
static void s626_detach(struct comedi_device *dev)
{
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
struct s626_private *devpriv = dev->private;
if (devpriv) {
@@ -2818,10 +2817,7 @@ static void s626_detach(struct comedi_device *dev)
if (devpriv->base_addr)
iounmap(devpriv->base_addr);
}
- if (pcidev) {
- if (dev->iobase)
- comedi_pci_disable(pcidev);
- }
+ comedi_pci_disable(dev);
}
static struct comedi_driver s626_driver = {
diff --git a/drivers/staging/comedi/drivers/skel.c b/drivers/staging/comedi/drivers/skel.c
index 1737c2a06ae3..f5d708c3aa5b 100644
--- a/drivers/staging/comedi/drivers/skel.c
+++ b/drivers/staging/comedi/drivers/skel.c
@@ -606,7 +606,6 @@ static void skel_detach(struct comedi_device *dev)
{
const struct skel_board *thisboard = comedi_board(dev);
struct skel_private *devpriv = dev->private;
- struct pci_dev *pcidev = comedi_to_pci_dev(dev);
if (!thisboard || !devpriv)
return;
@@ -626,8 +625,7 @@ static void skel_detach(struct comedi_device *dev)
* If PCI device enabled by _auto_attach() (or _attach()),
* disable it here.
*/
- if (pcidev && dev->iobase)
- comedi_pci_disable(pcidev);
+ comedi_pci_disable(dev);
} else {
/*
* ISA board