From 7f072f54ae5dc9965cbe450419b1389d13e2b849 Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Wed, 13 Mar 2013 10:35:51 -0700 Subject: 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 Cc: Ian Abbott Cc: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/icp_multi.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'drivers/staging/comedi/drivers/icp_multi.c') 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 = { -- cgit v1.2.3-59-g8ed1b