aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci-driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r--drivers/pci/pci-driver.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 38f3c0140dfb..454853507b7e 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -267,11 +267,19 @@ static long local_pci_probe(void *_ddi)
267 pm_runtime_get_sync(dev); 267 pm_runtime_get_sync(dev);
268 pci_dev->driver = pci_drv; 268 pci_dev->driver = pci_drv;
269 rc = pci_drv->probe(pci_dev, ddi->id); 269 rc = pci_drv->probe(pci_dev, ddi->id);
270 if (rc) { 270 if (!rc)
271 return rc;
272 if (rc < 0) {
271 pci_dev->driver = NULL; 273 pci_dev->driver = NULL;
272 pm_runtime_put_sync(dev); 274 pm_runtime_put_sync(dev);
275 return rc;
273 } 276 }
274 return rc; 277 /*
278 * Probe function should return < 0 for failure, 0 for success
279 * Treat values > 0 as success, but warn.
280 */
281 dev_warn(dev, "Driver probe function unexpectedly returned %d\n", rc);
282 return 0;
275} 283}
276 284
277static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev, 285static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
@@ -602,18 +610,10 @@ static int pci_pm_prepare(struct device *dev)
602 return error; 610 return error;
603} 611}
604 612
605static void pci_pm_complete(struct device *dev)
606{
607 struct device_driver *drv = dev->driver;
608
609 if (drv && drv->pm && drv->pm->complete)
610 drv->pm->complete(dev);
611}
612 613
613#else /* !CONFIG_PM_SLEEP */ 614#else /* !CONFIG_PM_SLEEP */
614 615
615#define pci_pm_prepare NULL 616#define pci_pm_prepare NULL
616#define pci_pm_complete NULL
617 617
618#endif /* !CONFIG_PM_SLEEP */ 618#endif /* !CONFIG_PM_SLEEP */
619 619
@@ -1124,9 +1124,8 @@ static int pci_pm_runtime_idle(struct device *dev)
1124 1124
1125#ifdef CONFIG_PM 1125#ifdef CONFIG_PM
1126 1126
1127const struct dev_pm_ops pci_dev_pm_ops = { 1127static const struct dev_pm_ops pci_dev_pm_ops = {
1128 .prepare = pci_pm_prepare, 1128 .prepare = pci_pm_prepare,
1129 .complete = pci_pm_complete,
1130 .suspend = pci_pm_suspend, 1129 .suspend = pci_pm_suspend,
1131 .resume = pci_pm_resume, 1130 .resume = pci_pm_resume,
1132 .freeze = pci_pm_freeze, 1131 .freeze = pci_pm_freeze,
@@ -1319,7 +1318,7 @@ struct bus_type pci_bus_type = {
1319 .probe = pci_device_probe, 1318 .probe = pci_device_probe,
1320 .remove = pci_device_remove, 1319 .remove = pci_device_remove,
1321 .shutdown = pci_device_shutdown, 1320 .shutdown = pci_device_shutdown,
1322 .dev_attrs = pci_dev_attrs, 1321 .dev_groups = pci_dev_groups,
1323 .bus_groups = pci_bus_groups, 1322 .bus_groups = pci_bus_groups,
1324 .drv_groups = pci_drv_groups, 1323 .drv_groups = pci_drv_groups,
1325 .pm = PCI_PM_OPS_PTR, 1324 .pm = PCI_PM_OPS_PTR,