Skip to contentSkip to conversation

PCI: ACPI: PM: Fix debug message in acpi_pci_set_power_state()

PATCH In review Rafael J. Wysocki 4 participants 4 messages Mar 25, 2021 – Apr 1, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PCI: ACPI: PM: Fix debug message in acpi_pci_set_power_state()

From: Rafael J. Wysocki <[email protected]>

If PCI_D3cold is passed to acpi_pci_set_power_state() as the second argument and there is no ACPI D3cold support for the given device, the debug message printed by that function will state that the device power state has been changed to D3cold, while in fact it will be D3hot, because acpi_device_set_power() falls back to D3hot automatically if D3cold is not supported without returning an error.

To address this issue, modify the debug message in question to print the current power state of the target PCI device's ACPI companion instead of printing the target power state which may not reflect the real final power state of the device.

---
 drivers/pci/pci-acpi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-acpi.c +1 -1
Index: linux-pm/drivers/pci/pci-acpi.c
===================================================================
@@ -1021,7 +1021,7 @@ static int acpi_pci_set_power_state(stru
 
 	if (!error)
 		pci_dbg(dev, "power state changed by ACPI to %s\n",
-			 acpi_power_state_string(state_conv[state]));
+		        acpi_power_state_string(adev->power.state));
 
 	return error;
 }
Reviewed-by on v1 1/1
#1 lore raw

Hi,

[...]

Quoted 4 lines

To address this issue, modify the debug message in question to print the current power state of the target PCI device's ACPI companion instead of printing the target power state which may not reflect the real final power state of the device.

[...]

Thank you!

Krzysztof

#2 lore raw
In reply to Rafael J. Wysocki
Quoted 9 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

If PCI_D3cold is passed to acpi_pci_set_power_state() as the second argument and there is no ACPI D3cold support for the given device, the debug message printed by that function will state that the device power state has been changed to D3cold, while in fact it will be D3hot, because acpi_device_set_power() falls back to D3hot automatically if D3cold is not supported without returning an error.

Quoted 6 lines

To address this issue, modify the debug message in question to print the current power state of the target PCI device's ACPI companion instead of printing the target power state which may not reflect the real final power state of the device.

Applied with Krzysztof's reviewed-by to pci/pm for v5.13, thanks!

Let me know if you have nearby or related changes that you'd rather take via your tree.

Quoted 20 lines
---
 drivers/pci/pci-acpi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-pm/drivers/pci/pci-acpi.c
===================================================================

drivers/pci/pci-acpi.c +1 -1
@@ -1021,7 +1021,7 @@ static int acpi_pci_set_power_state(stru
 
 	if (!error)
 		pci_dbg(dev, "power state changed by ACPI to %s\n",
-			 acpi_power_state_string(state_conv[state]));
+		        acpi_power_state_string(adev->power.state));
 
 	return error;
 }
#3 lore raw
Quoted 16 lines · Bjorn Helgaas
Quoted 14 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

If PCI_D3cold is passed to acpi_pci_set_power_state() as the second argument and there is no ACPI D3cold support for the given device, the debug message printed by that function will state that the device power state has been changed to D3cold, while in fact it will be D3hot, because acpi_device_set_power() falls back to D3hot automatically if D3cold is not supported without returning an error.

To address this issue, modify the debug message in question to print the current power state of the target PCI device's ACPI companion instead of printing the target power state which may not reflect the real final power state of the device.

Quoted 6 lines
Quoted 1 line

Applied with Krzysztof's reviewed-by to pci/pm for v5.13, thanks!

Let me know if you have nearby or related changes that you'd rather take via your tree.

I don't have any, thank you!