diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/comedi/comedi_pci.c | 5 | ||||
-rw-r--r-- | drivers/staging/comedi/comedidev.h | 1 | ||||
-rw-r--r-- | drivers/staging/comedi/drivers.c | 1 |
3 files changed, 6 insertions, 1 deletions
diff --git a/drivers/staging/comedi/comedi_pci.c b/drivers/staging/comedi/comedi_pci.c index b164b0353ebe..6f3cdf88f05e 100644 --- a/drivers/staging/comedi/comedi_pci.c +++ b/drivers/staging/comedi/comedi_pci.c @@ -55,6 +55,8 @@ int comedi_pci_enable(struct comedi_device *dev) : dev->driver->driver_name); if (rc < 0) pci_disable_device(pcidev); + else + dev->ioenabled = true; return rc; } @@ -68,10 +70,11 @@ void comedi_pci_disable(struct comedi_device *dev) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); - if (pcidev && dev->iobase) { + if (pcidev && dev->ioenabled) { pci_release_regions(pcidev); pci_disable_device(pcidev); } + dev->ioenabled = false; } EXPORT_SYMBOL_GPL(comedi_pci_disable); diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 86de4ff9501a..9c8662a051dc 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -209,6 +209,7 @@ struct comedi_device { const void *board_ptr; bool attached:1; bool in_request_module:1; + bool ioenabled:1; spinlock_t spinlock; struct mutex mutex; diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c index 87052735d91c..4724f275830c 100644 --- a/drivers/staging/comedi/drivers.c +++ b/drivers/staging/comedi/drivers.c @@ -110,6 +110,7 @@ static void cleanup_device(struct comedi_device *dev) dev->board_name = NULL; dev->board_ptr = NULL; dev->iobase = 0; + dev->ioenabled = false; dev->irq = 0; dev->read_subdev = NULL; dev->write_subdev = NULL; |