Skip to contentSkip to conversation

PCI / ACPI / PM: Use correct power state strings in messages

PATCH In review Rafael J. Wysocki 2 participants 5 messages Jun 13, 2013 – Jun 14, 2013

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

PATCH 1/1 PCI / ACPI / PM: Use correct power state strings in messages

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

Make acpi_pci_set_power_state() print the name of the ACPI device power state the device has been actually put into instead of printing the name of the requested PCI device power state, which need not be the same.

---

For 3.11.

Thanks,
Rafael

---
 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
===================================================================
@@ -211,7 +211,7 @@ static int acpi_pci_set_power_state(stru
 
 	if (!error)
 		dev_info(&dev->dev, "power state changed by ACPI to %s\n",
-			 pci_power_name(state));
+			 acpi_power_state_string(state_conv[state]));
 
 	return error;
 }
maintainer
#1 lore raw
Quoted 25 lines · Rafael J. Wysocki

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

Make acpi_pci_set_power_state() print the name of the ACPI device power state the device has been actually put into instead of printing the name of the requested PCI device power state, which need not be the same.

---

For 3.11.

Thanks,
Rafael

---
 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 static int acpi_pci_set_power_state(stru · line 217

Quoted 8 lines
drivers/pci/pci-acpi.c +1 -1
@@ -211,7 +211,7 @@ static int acpi_pci_set_power_state(stru
 
        if (!error)
                dev_info(&dev->dev, "power state changed by ACPI to %s\n",
-                        pci_power_name(state));
+                        acpi_power_state_string(state_conv[state]));
 
        return error;
 }

Just to double-check this, it *looks* like the effective change is that for PCI_D3hot and PCI_D3cold, we'll print "(unknown)" instead of "D3hot" and "D3cold" because state_conv[] folds both PCI_D3hot and PCI_D3cold into ACPI_STATE_D3, and acpi_power_state_string() doesn't have a case for ACPI_STATE_D3.

Is that what you intended?

Bjorn

#2 lore raw
Quoted 31 lines · Bjorn Helgaas
Quoted 30 lines · Rafael J. Wysocki

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

Make acpi_pci_set_power_state() print the name of the ACPI device power state the device has been actually put into instead of printing the name of the requested PCI device power state, which need not be the same.

---

For 3.11.

Thanks,
Rafael

---
 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
@@ -211,7 +211,7 @@ static int acpi_pci_set_power_state(stru
 
        if (!error)
                dev_info(&dev->dev, "power state changed by ACPI to %s\n",
-                        pci_power_name(state));
+                        acpi_power_state_string(state_conv[state]));
 
Quoted 9 lines

drivers/pci/pci-acpi.c static int acpi_pci_set_power_state(stru · line 217

Quoted 3 lines
drivers/pci/pci-acpi.c +0 -0
        return error;
 }

Just to double-check this, it *looks* like the effective change is that for PCI_D3hot and PCI_D3cold, we'll print "(unknown)" instead of "D3hot" and "D3cold" because state_conv[] folds both PCI_D3hot and PCI_D3cold into ACPI_STATE_D3, and acpi_power_state_string() doesn't have a case for ACPI_STATE_D3.

No, it won't work like this, because ACPI_STATE_D3 == ACPI_STATE_D3_COLD. :-)

So, actually, "D3cold" will be printed for both PCI_D3hot and PCI_D3cold (and I have tested this).

Well, I think it's better to actually replace ACPI_STATE_D3 everywhere in pci-acpi.c with ACPI_STATE_D3_COLD to avoid that confusion. Do you want me to prepare a patch?

Rafael

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
maintainer
#3 lore raw
Quoted 42 lines · Rafael J. Wysocki
Quoted 31 lines · Bjorn Helgaas
Quoted 30 lines · Rafael J. Wysocki

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

Make acpi_pci_set_power_state() print the name of the ACPI device power state the device has been actually put into instead of printing the name of the requested PCI device power state, which need not be the same.

---

For 3.11.

Thanks,
Rafael

---
 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
@@ -211,7 +211,7 @@ static int acpi_pci_set_power_state(stru
 
        if (!error)
                dev_info(&dev->dev, "power state changed by ACPI to %s\n",
-                        pci_power_name(state));
+                        acpi_power_state_string(state_conv[state]));
 
Quoted 9 lines

drivers/pci/pci-acpi.c static int acpi_pci_set_power_state(stru · line 217

Quoted 3 lines
drivers/pci/pci-acpi.c +0 -0
        return error;
 }

Just to double-check this, it *looks* like the effective change is that for PCI_D3hot and PCI_D3cold, we'll print "(unknown)" instead of "D3hot" and "D3cold" because state_conv[] folds both PCI_D3hot and PCI_D3cold into ACPI_STATE_D3, and acpi_power_state_string() doesn't have a case for ACPI_STATE_D3.

Quoted 4 lines

No, it won't work like this, because ACPI_STATE_D3 == ACPI_STATE_D3_COLD. :-)

So, actually, "D3cold" will be printed for both PCI_D3hot and PCI_D3cold (and I have tested this).

Ah, right, I should have noticed that.

Quoted 3 lines

Well, I think it's better to actually replace ACPI_STATE_D3 everywhere in pci-acpi.c with ACPI_STATE_D3_COLD to avoid that confusion. Do you want me to prepare a patch?

If the following is OK, I'll just put it in my pci/misc branch:

commit fc6504b3a4dc9beae782a11e6f7c3c4a9f077fb8

Author: Rafael J. Wysocki <[email protected]>
Date:   Fri Jun 14 00:29:50 2013 +0200

PCI / ACPI / PM: Use correct power state strings in messages

Make acpi_pci_set_power_state() print the name of the ACPI device power state the device has been actually put into instead of printing the name of the requested PCI device power state, which need not be the same.

[bhelgaas: use ACPI_STATE_D3_COLD (ACPI_STATE_D3 == ACPI_STATE_D3_COLD)]
drivers/pci/pci-acpi.c +3 -3
index 6c15d6a..dbdc5f7 100644
@@ -186,8 +186,8 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
 		[PCI_D0] = ACPI_STATE_D0,
 		[PCI_D1] = ACPI_STATE_D1,
 		[PCI_D2] = ACPI_STATE_D2,
-		[PCI_D3hot] = ACPI_STATE_D3,
-		[PCI_D3cold] = ACPI_STATE_D3
+		[PCI_D3hot] = ACPI_STATE_D3_COLD,
+		[PCI_D3cold] = ACPI_STATE_D3_COLD,
 	};
 	int error = -EINVAL;
 
@@ -211,7 +211,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
 
 	if (!error)
 		dev_info(&dev->dev, "power state changed by ACPI to %s\n",
-			 pci_power_name(state));
+			 acpi_power_state_string(state_conv[state]));
 
 	return error;
 }
#4 lore raw
Quoted 48 lines · Bjorn Helgaas
Quoted 42 lines · Rafael J. Wysocki
Quoted 31 lines · Bjorn Helgaas
Quoted 30 lines · Rafael J. Wysocki

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

Make acpi_pci_set_power_state() print the name of the ACPI device power state the device has been actually put into instead of printing the name of the requested PCI device power state, which need not be the same.

---

For 3.11.

Thanks,
Rafael

---
 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
@@ -211,7 +211,7 @@ static int acpi_pci_set_power_state(stru
 
        if (!error)
                dev_info(&dev->dev, "power state changed by ACPI to %s\n",
-                        pci_power_name(state));
+                        acpi_power_state_string(state_conv[state]));
 
Quoted 9 lines

drivers/pci/pci-acpi.c static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state) · line 217

Quoted 3 lines
drivers/pci/pci-acpi.c +0 -0
        return error;
 }

Just to double-check this, it *looks* like the effective change is that for PCI_D3hot and PCI_D3cold, we'll print "(unknown)" instead of "D3hot" and "D3cold" because state_conv[] folds both PCI_D3hot and PCI_D3cold into ACPI_STATE_D3, and acpi_power_state_string() doesn't have a case for ACPI_STATE_D3.

Quoted 4 lines

No, it won't work like this, because ACPI_STATE_D3 == ACPI_STATE_D3_COLD. :-)

So, actually, "D3cold" will be printed for both PCI_D3hot and PCI_D3cold (and I have tested this).

Quoted 7 lines

Ah, right, I should have noticed that.

Quoted 3 lines

Well, I think it's better to actually replace ACPI_STATE_D3 everywhere in pci-acpi.c with ACPI_STATE_D3_COLD to avoid that confusion. Do you want me to prepare a patch?

If the following is OK, I'll just put it in my pci/misc branch:

Yes, it is, thanks!

Rafael

Quoted 39 lines

commit fc6504b3a4dc9beae782a11e6f7c3c4a9f077fb8

Author: Rafael J. Wysocki <[email protected]>
Date:   Fri Jun 14 00:29:50 2013 +0200

PCI / ACPI / PM: Use correct power state strings in messages

Make acpi_pci_set_power_state() print the name of the ACPI device power state the device has been actually put into instead of printing the name of the requested PCI device power state, which need not be the same.

[bhelgaas: use ACPI_STATE_D3_COLD (ACPI_STATE_D3 == ACPI_STATE_D3_COLD)]
drivers/pci/pci-acpi.c +3 -3
index 6c15d6a..dbdc5f7 100644
@@ -186,8 +186,8 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
 		[PCI_D0] = ACPI_STATE_D0,
 		[PCI_D1] = ACPI_STATE_D1,
 		[PCI_D2] = ACPI_STATE_D2,
-		[PCI_D3hot] = ACPI_STATE_D3,
-		[PCI_D3cold] = ACPI_STATE_D3
+		[PCI_D3hot] = ACPI_STATE_D3_COLD,
+		[PCI_D3cold] = ACPI_STATE_D3_COLD,
 	};
 	int error = -EINVAL;
 
@@ -211,7 +211,7 @@ static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
 
 	if (!error)
 		dev_info(&dev->dev, "power state changed by ACPI to %s\n",
-			 pci_power_name(state));
+			 acpi_power_state_string(state_conv[state]));
 
 	return error;
 }
Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.