diff options
author | H Hartley Sweeten <hsweeten@visionengravers.com> | 2013-03-13 10:35:51 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-03-14 13:42:49 -0700 |
commit | 7f072f54ae5dc9965cbe450419b1389d13e2b849 (patch) | |
tree | 174b0d1fbd2d0143d956dc7d0b13be3a3a915695 /drivers/staging/comedi/drivers/adl_pci7x3x.c | |
parent | staging: dgrp: cleanup sparse warnings (diff) | |
download | linux-dev-7f072f54ae5dc9965cbe450419b1389d13e2b849.tar.xz linux-dev-7f072f54ae5dc9965cbe450419b1389d13e2b849.zip |
staging: comedi_pci: make comedi_pci_disable() safe to call
Currently all the comedi PCI drivers need to do some checking in
their (*detach) before calling comedi_pci_disable() in order to
make sure the PCI device has actually be enabled.
Change the parameter passed to comedi_pci_disable() from a struct
pci_dev pointer to a comedi_device pointer and have comedi_pci_disable()
handle all the checking.
For most comedi PCI drivers this also allows removing the local
variable holding the pointer to the pci_dev. For some of the drivers
comedi_pci_disable can now be used directly as the (*detach) function.
The National Instruments drivers that use the mite module currently
enable/disable the PCI device in the mite module. For those drivers
move the call to comedi_pci_disable into the driver and make sure
dev->iobase is set to a non-zero value.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/drivers/adl_pci7x3x.c')
-rw-r--r-- | drivers/staging/comedi/drivers/adl_pci7x3x.c | 12 |
1 files changed, 1 insertions, 11 deletions
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, |