summaryrefslogtreecommitdiffstats
path: root/drivers/staging/comedi/comedi_pci.c
diff options
context:
space:
mode:
authorH Hartley Sweeten <hsweeten@visionengravers.com>2013-03-13 10:36:31 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-14 13:56:19 -0700
commit818f569fe930c5b8a05d1a44ece3c63c99c13c88 (patch)
treedccc116aae41ca2361fbb0f4f7d1e330347e3b6f /drivers/staging/comedi/comedi_pci.c
parent7f072f54ae5dc9965cbe450419b1389d13e2b849 (diff)
downloadop-kernel-dev-818f569fe930c5b8a05d1a44ece3c63c99c13c88.zip
op-kernel-dev-818f569fe930c5b8a05d1a44ece3c63c99c13c88.tar.gz
staging: comedi_pci: pass comedi_device to comedi_pci_enable()
Make comedi_pci_enable() use the same parameter type as comedi_pci_disable(). This also allows comedi_pci_enable to automatically determine the resource name passed to pci_request_regions(). Make sure the errno value returned is passed on instead of assuming an errno. Also, remove any kernel noise that is generated when the call fails. The National Instruments drivers that use the mite module currently enable the PCI device in the mite module. For those drivers move the call to comedi_pci_enable into the driver. Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Cc: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi/comedi_pci.c')
-rw-r--r--drivers/staging/comedi/comedi_pci.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/staging/comedi/comedi_pci.c b/drivers/staging/comedi/comedi_pci.c
index bee012c..b164b03 100644
--- a/drivers/staging/comedi/comedi_pci.c
+++ b/drivers/staging/comedi/comedi_pci.c
@@ -36,18 +36,23 @@ EXPORT_SYMBOL_GPL(comedi_to_pci_dev);
/**
* comedi_pci_enable() - Enable the PCI device and request the regions.
- * @pcidev: pci_dev struct
- * @res_name: name for the requested reqource
+ * @dev: comedi_device struct
*/
-int comedi_pci_enable(struct pci_dev *pcidev, const char *res_name)
+int comedi_pci_enable(struct comedi_device *dev)
{
+ struct pci_dev *pcidev = comedi_to_pci_dev(dev);
int rc;
+ if (!pcidev)
+ return -ENODEV;
+
rc = pci_enable_device(pcidev);
if (rc < 0)
return rc;
- rc = pci_request_regions(pcidev, res_name);
+ rc = pci_request_regions(pcidev, dev->board_name
+ ? dev->board_name
+ : dev->driver->driver_name);
if (rc < 0)
pci_disable_device(pcidev);
OpenPOWER on IntegriCloud