Skip to contentSkip to conversation

PCI / PM: Fix messages printed by acpi_pci_set_power_state()

PATCH RESEND Applied Rafael J. Wysocki 2 participants 2 messages Aug 4, 2012 – Aug 15, 2012

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

PATCH RESEND 1/1 PCI / PM: Fix messages printed by acpi_pci_set_power_state()

If a PCI device is put into D3_cold by acpi_bus_set_power(), the message printed by acpi_pci_set_power_state() says that its power state has been changed to D4, which doesn't make sense. In turn, if the device is put into D3_hot, the message simply says "D3" without specifying the variant of the D3 state.

Fix this by using the pci_power_name() macro for printing the state name instead of building it from the numeric value corresponding to the given state directly.

---
 drivers/pci/pci-acpi.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/pci-acpi.c +2 -2
Index: linux/drivers/pci/pci-acpi.c
===================================================================
@@ -266,8 +266,8 @@ static int acpi_pci_set_power_state(stru
 	}
 
 	if (!error)
-		dev_printk(KERN_INFO, &dev->dev,
-				"power state changed by ACPI to D%d\n", state);
+		dev_info(&dev->dev, "power state changed by ACPI to %s\n",
+			 pci_power_name(state));
 
 	return error;
 }
maintainer Applied
#1 lore raw
Quoted 7 lines · Rafael J. Wysocki

If a PCI device is put into D3_cold by acpi_bus_set_power(), the message printed by acpi_pci_set_power_state() says that its power state has been changed to D4, which doesn't make sense. In turn, if the device is put into D3_hot, the message simply says "D3" without specifying the variant of the D3 state.

Quoted 5 lines

Fix this by using the pci_power_name() macro for printing the state name instead of building it from the numeric value corresponding to the given state directly.

Applied to my for-linus branch, since this fixes a minor issue introduced with the runtime D3cold support we merged for 3.6. Thanks!

Quoted 19 lines
---
 drivers/pci/pci-acpi.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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

drivers/pci/pci-acpi.c +2 -2
@@ -266,8 +266,8 @@ static int acpi_pci_set_power_state(stru
        }
 
        if (!error)
-               dev_printk(KERN_INFO, &dev->dev,
-                               "power state changed by ACPI to D%d\n", state);
+               dev_info(&dev->dev, "power state changed by ACPI to %s\n",
+                        pci_power_name(state));
 
        return error;
 }