]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
PCI: PCIe portdrv: Fix suspend and resume of PCI Express port services
authorRafael J. Wysocki <rjw@sisk.pl>
Thu, 1 Jan 2009 18:51:15 +0000 (19:51 +0100)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 7 Jan 2009 19:13:26 +0000 (11:13 -0800)
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>
drivers/pci/pcie/portdrv_bus.c
drivers/pci/pcie/portdrv_core.c

index 359fe5568df10263cd9c0620c42e7f9c8ffef1bd..3a03db4323ad25f6882808f07100e4f43b04abdb 100644 (file)
 #include "portdrv.h"
 
 static int pcie_port_bus_match(struct device *dev, struct device_driver *drv);
-static int pcie_port_bus_suspend(struct device *dev, pm_message_t state);
-static int pcie_port_bus_resume(struct device *dev);
 
 struct bus_type pcie_port_bus_type = {
        .name           = "pci_express",
        .match          = pcie_port_bus_match,
-       .suspend        = pcie_port_bus_suspend,
-       .resume         = pcie_port_bus_resume, 
 };
 EXPORT_SYMBOL_GPL(pcie_port_bus_type);
 
@@ -48,33 +44,3 @@ static int pcie_port_bus_match(struct device *dev, struct device_driver *drv)
 
        return 1;
 }
-
-static int pcie_port_bus_suspend(struct device *dev, pm_message_t state)
-{
-       struct pcie_device *pciedev;
-       struct pcie_port_service_driver *driver;
-
-       if (!dev || !dev->driver)
-               return 0;
-
-       pciedev = to_pcie_device(dev);
-       driver = to_service_driver(dev->driver);
-       if (driver && driver->suspend)
-               driver->suspend(pciedev, state);
-       return 0;
-}
-
-static int pcie_port_bus_resume(struct device *dev)
-{
-       struct pcie_device *pciedev;
-       struct pcie_port_service_driver *driver;
-
-       if (!dev || !dev->driver)
-               return 0;
-
-       pciedev = to_pcie_device(dev);
-       driver = to_service_driver(dev->driver);
-       if (driver && driver->resume)
-               driver->resume(pciedev);
-       return 0;
-}
index 8f09b353d2afc6b9cea08e11d5e414e30b9b21ad..6ca5a40cc61c19042c85d20dfa12ee121f1650ed 100644 (file)
@@ -63,37 +63,6 @@ static int pcie_port_remove_service(struct device *dev)
 
 static void pcie_port_shutdown_service(struct device *dev) {}
 
-static int pcie_port_suspend_service(struct device *dev, pm_message_t state)
-{
-       struct pcie_device *pciedev;
-       struct pcie_port_service_driver *driver;
-
-       if (!dev || !dev->driver)
-               return 0;
-
-       pciedev = to_pcie_device(dev);
-       driver = to_service_driver(dev->driver);
-       if (driver && driver->suspend)
-               driver->suspend(pciedev, state);
-       return 0;
-}
-
-static int pcie_port_resume_service(struct device *dev)
-{
-       struct pcie_device *pciedev;
-       struct pcie_port_service_driver *driver;
-
-       if (!dev || !dev->driver)
-               return 0;
-
-       pciedev = to_pcie_device(dev);
-       driver = to_service_driver(dev->driver);
-
-       if (driver && driver->resume)
-               driver->resume(pciedev);
-       return 0;
-}
-
 /**
  * release_pcie_device - free PCI Express port service device structure
  * @dev: Port service device to release
@@ -462,8 +431,6 @@ int pcie_port_service_register(struct pcie_port_service_driver *new)
        new->driver.probe = pcie_port_probe_service;
        new->driver.remove = pcie_port_remove_service;
        new->driver.shutdown = pcie_port_shutdown_service;
-       new->driver.suspend = pcie_port_suspend_service;
-       new->driver.resume = pcie_port_resume_service;
 
        return driver_register(&new->driver);
 }