]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.4.44/pci-pm-fix-fallback-to-pci_d0-in-pci_platform_power_transition.patch
4.14-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.4.44 / pci-pm-fix-fallback-to-pci_d0-in-pci_platform_power_transition.patch
1 From 769ba7212f2059ca9fe0c73371e3d415c8c1c529 Mon Sep 17 00:00:00 2001
2 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
3 Date: Fri, 12 Apr 2013 13:58:17 +0000
4 Subject: PCI/PM: Fix fallback to PCI_D0 in pci_platform_power_transition()
5
6 From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
7
8 commit 769ba7212f2059ca9fe0c73371e3d415c8c1c529 upstream.
9
10 Commit b51306c (PCI: Set device power state to PCI_D0 for device
11 without native PM support) modified pci_platform_power_transition()
12 by adding code causing dev->current_state for devices that don't
13 support native PCI PM but are power-manageable by the platform to be
14 changed to PCI_D0 regardless of the value returned by the preceding
15 platform_pci_set_power_state(). In particular, that also is done
16 if the platform_pci_set_power_state() has been successful, which
17 causes the correct power state of the device set by
18 pci_update_current_state() in that case to be overwritten by PCI_D0.
19
20 Fix that mistake by making the fallback to PCI_D0 only happen if
21 the platform_pci_set_power_state() has returned an error.
22
23 [bhelgaas: folded in Yinghai's simplification, added URL & stable info]
24 Reference: http://lkml.kernel.org/r/27806FC4E5928A408B78E88BBC67A2306F466BBA@ORSMSX101.amr.corp.intel.com
25 Reported-by: Chris J. Benenati <chris.j.benenati@intel.com>
26 Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
27 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
28 Acked-by: Yinghai Lu <yinghai@kernel.org>
29 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
30
31 ---
32 drivers/pci/pci.c | 12 ++++--------
33 1 file changed, 4 insertions(+), 8 deletions(-)
34
35 --- a/drivers/pci/pci.c
36 +++ b/drivers/pci/pci.c
37 @@ -673,15 +673,11 @@ static int pci_platform_power_transition
38 error = platform_pci_set_power_state(dev, state);
39 if (!error)
40 pci_update_current_state(dev, state);
41 - /* Fall back to PCI_D0 if native PM is not supported */
42 - if (!dev->pm_cap)
43 - dev->current_state = PCI_D0;
44 - } else {
45 + } else
46 error = -ENODEV;
47 - /* Fall back to PCI_D0 if native PM is not supported */
48 - if (!dev->pm_cap)
49 - dev->current_state = PCI_D0;
50 - }
51 +
52 + if (error && !dev->pm_cap) /* Fall back to PCI_D0 */
53 + dev->current_state = PCI_D0;
54
55 return error;
56 }