]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/pci/pci-driver.c
PCI / PM: Drop unnecessary invocations of pcibios_pm_ops callbacks
[mirror_ubuntu-bionic-kernel.git] / drivers / pci / pci-driver.c
index 11bd267fc1371acc303795876a6fba0b7725767a..c1aeeb10539e416d566a4a3e6af15cec72fb7367 100644 (file)
@@ -689,8 +689,11 @@ static int pci_pm_prepare(struct device *dev)
 
        if (drv && drv->pm && drv->pm->prepare) {
                int error = drv->pm->prepare(dev);
-               if (error)
+               if (error < 0)
                        return error;
+
+               if (!error && dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_PREPARE))
+                       return 0;
        }
        return pci_dev_keep_suspended(to_pci_dev(dev));
 }
@@ -919,9 +922,6 @@ static int pci_pm_freeze(struct device *dev)
                        return error;
        }
 
-       if (pcibios_pm_ops.freeze)
-               return pcibios_pm_ops.freeze(dev);
-
        return 0;
 }
 
@@ -983,12 +983,6 @@ static int pci_pm_thaw(struct device *dev)
        const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        int error = 0;
 
-       if (pcibios_pm_ops.thaw) {
-               error = pcibios_pm_ops.thaw(dev);
-               if (error)
-                       return error;
-       }
-
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_resume(dev);
 
@@ -1033,9 +1027,6 @@ static int pci_pm_poweroff(struct device *dev)
  Fixup:
        pci_fixup_device(pci_fixup_suspend, pci_dev);
 
-       if (pcibios_pm_ops.poweroff)
-               return pcibios_pm_ops.poweroff(dev);
-
        return 0;
 }
 
@@ -1108,12 +1099,6 @@ static int pci_pm_restore(struct device *dev)
        const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        int error = 0;
 
-       if (pcibios_pm_ops.restore) {
-               error = pcibios_pm_ops.restore(dev);
-               if (error)
-                       return error;
-       }
-
        /*
         * This is necessary for the hibernation error path in which restore is
         * called without restoring the standard config registers of the device.