diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2009-01-01 13:51:15 -0500 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-01-07 14:13:26 -0500 |
commit | e7ae88486670f3904f187d0fff9dcf469bcdd8ba (patch) | |
tree | c2a1ff5cb3a8b24778789720f9a64f59e679dfd0 /drivers/pci | |
parent | facf6d1627a33badbbc154524c4a2c73c51bdc99 (diff) |
PCI: PCIe portdrv: Fix suspend and resume of PCI Express port services
There is a problem with the suspend and resume of PCI Express port
service devices that the ->suspend() and ->resume() routines of each
service device are called twice in each suspend-resume cycle, which
is obviously wrong.
The scenario is that first, the PCI Express port driver calls
suspend and resume routines of each port service driver from its
pcie_portdrv_suspend() and pcie_portdrv_resume() callbacks,
respectively (which is correct), and second, the pcie_port_bus_type
driver calls them from its ->suspend() and ->resume() callbacks
(which is not correct, because it doesn't happen at the right time).
The solution is to remove the ->suspend() and ->resume() callbacks
from pcie_port_bus_type and the associated functions.
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/pcie/portdrv_bus.c | 34 | ||||
-rw-r--r-- | drivers/pci/pcie/portdrv_core.c | 33 |
2 files changed, 0 insertions, 67 deletions
diff --git a/drivers/pci/pcie/portdrv_bus.c b/drivers/pci/pcie/portdrv_bus.c index 359fe5568df1..3a03db4323ad 100644 --- a/drivers/pci/pcie/portdrv_bus.c +++ b/drivers/pci/pcie/portdrv_bus.c | |||
@@ -16,14 +16,10 @@ | |||
16 | #include "portdrv.h" | 16 | #include "portdrv.h" |
17 | 17 | ||
18 | static int pcie_port_bus_match(struct device *dev, struct device_driver *drv); | 18 | static int pcie_port_bus_match(struct device *dev, struct device_driver *drv); |
19 | static int pcie_port_bus_suspend(struct device *dev, pm_message_t state); | ||
20 | static int pcie_port_bus_resume(struct device *dev); | ||
21 | 19 | ||
22 | struct bus_type pcie_port_bus_type = { | 20 | struct bus_type pcie_port_bus_type = { |
23 | .name = "pci_express", | 21 | .name = "pci_express", |
24 | .match = pcie_port_bus_match, | 22 | .match = pcie_port_bus_match, |
25 | .suspend = pcie_port_bus_suspend, | ||
26 | .resume = pcie_port_bus_resume, | ||
27 | }; | 23 | }; |
28 | EXPORT_SYMBOL_GPL(pcie_port_bus_type); | 24 | EXPORT_SYMBOL_GPL(pcie_port_bus_type); |
29 | 25 | ||
@@ -48,33 +44,3 @@ static int pcie_port_bus_match(struct device *dev, struct device_driver *drv) | |||
48 | 44 | ||
49 | return 1; | 45 | return 1; |
50 | } | 46 | } |
51 | |||
52 | static int pcie_port_bus_suspend(struct device *dev, pm_message_t state) | ||
53 | { | ||
54 | struct pcie_device *pciedev; | ||
55 | struct pcie_port_service_driver *driver; | ||
56 | |||
57 | if (!dev || !dev->driver) | ||
58 | return 0; | ||
59 | |||
60 | pciedev = to_pcie_device(dev); | ||
61 | driver = to_service_driver(dev->driver); | ||
62 | if (driver && driver->suspend) | ||
63 | driver->suspend(pciedev, state); | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | static int pcie_port_bus_resume(struct device *dev) | ||
68 | { | ||
69 | struct pcie_device *pciedev; | ||
70 | struct pcie_port_service_driver *driver; | ||
71 | |||
72 | if (!dev || !dev->driver) | ||
73 | return 0; | ||
74 | |||
75 | pciedev = to_pcie_device(dev); | ||
76 | driver = to_service_driver(dev->driver); | ||
77 | if (driver && driver->resume) | ||
78 | driver->resume(pciedev); | ||
79 | return 0; | ||
80 | } | ||
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c index 8f09b353d2af..6ca5a40cc61c 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c | |||
@@ -63,37 +63,6 @@ static int pcie_port_remove_service(struct device *dev) | |||
63 | 63 | ||
64 | static void pcie_port_shutdown_service(struct device *dev) {} | 64 | static void pcie_port_shutdown_service(struct device *dev) {} |
65 | 65 | ||
66 | static int pcie_port_suspend_service(struct device *dev, pm_message_t state) | ||
67 | { | ||
68 | struct pcie_device *pciedev; | ||
69 | struct pcie_port_service_driver *driver; | ||
70 | |||
71 | if (!dev || !dev->driver) | ||
72 | return 0; | ||
73 | |||
74 | pciedev = to_pcie_device(dev); | ||
75 | driver = to_service_driver(dev->driver); | ||
76 | if (driver && driver->suspend) | ||
77 | driver->suspend(pciedev, state); | ||
78 | return 0; | ||
79 | } | ||
80 | |||
81 | static int pcie_port_resume_service(struct device *dev) | ||
82 | { | ||
83 | struct pcie_device *pciedev; | ||
84 | struct pcie_port_service_driver *driver; | ||
85 | |||
86 | if (!dev || !dev->driver) | ||
87 | return 0; | ||
88 | |||
89 | pciedev = to_pcie_device(dev); | ||
90 | driver = to_service_driver(dev->driver); | ||
91 | |||
92 | if (driver && driver->resume) | ||
93 | driver->resume(pciedev); | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | /** | 66 | /** |
98 | * release_pcie_device - free PCI Express port service device structure | 67 | * release_pcie_device - free PCI Express port service device structure |
99 | * @dev: Port service device to release | 68 | * @dev: Port service device to release |
@@ -462,8 +431,6 @@ int pcie_port_service_register(struct pcie_port_service_driver *new) | |||
462 | new->driver.probe = pcie_port_probe_service; | 431 | new->driver.probe = pcie_port_probe_service; |
463 | new->driver.remove = pcie_port_remove_service; | 432 | new->driver.remove = pcie_port_remove_service; |
464 | new->driver.shutdown = pcie_port_shutdown_service; | 433 | new->driver.shutdown = pcie_port_shutdown_service; |
465 | new->driver.suspend = pcie_port_suspend_service; | ||
466 | new->driver.resume = pcie_port_resume_service; | ||
467 | 434 | ||
468 | return driver_register(&new->driver); | 435 | return driver_register(&new->driver); |
469 | } | 436 | } |