[PATCH] PCI / PM: Fix messages printed by acpi_pci_set_power_state()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 says just
"D3" without specifying which variant of D3 it is.

Fix that by using an array of state names corresponding to the
PCI device power states instead of building the state name from
the numeric value corresponding to the given state directly.

Signed-off-by: Rafael J. Wysocki <rjw@xxxxxxx>
---
 drivers/pci/pci-acpi.c |   14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

Index: linux/drivers/pci/pci-acpi.c
===================================================================
--- linux.orig/drivers/pci/pci-acpi.c
+++ linux/drivers/pci/pci-acpi.c
@@ -265,9 +265,17 @@ static int acpi_pci_set_power_state(stru
 		error = acpi_bus_set_power(handle, state_conv[state]);
 	}
 
-	if (!error)
-		dev_printk(KERN_INFO, &dev->dev,
-				"power state changed by ACPI to D%d\n", state);
+	if (!error) {
+		static const char *state_name[] = {
+			[PCI_D0] = "D0",
+			[PCI_D1] = "D1",
+			[PCI_D2] = "D2",
+			[PCI_D3hot] = "D3hot",
+			[PCI_D3cold] = "D3cold"
+		};
+		dev_info(&dev->dev, "power state changed by ACPI to %s\n",
+			 state_name[state]);
+	}
 
 	return error;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux