linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: ACPI: PM: Fix debug message in acpi_pci_set_power_state()
@ 2021-03-25 18:57 Rafael J. Wysocki
  2021-03-26  6:40 ` Krzysztof Wilczyński
  2021-03-31 21:08 ` Bjorn Helgaas
  0 siblings, 2 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-03-25 18:57 UTC (permalink / raw)
  To: Linux PCI, Linux ACPI; +Cc: LKML, Bjorn Helgaas, Mika Westerberg, David Box

From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/pci/pci-acpi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-pm/drivers/pci/pci-acpi.c
===================================================================
--- linux-pm.orig/drivers/pci/pci-acpi.c
+++ 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;
 }




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: ACPI: PM: Fix debug message in acpi_pci_set_power_state()
  2021-03-25 18:57 [PATCH] PCI: ACPI: PM: Fix debug message in acpi_pci_set_power_state() Rafael J. Wysocki
@ 2021-03-26  6:40 ` Krzysztof Wilczyński
  2021-03-31 21:08 ` Bjorn Helgaas
  1 sibling, 0 replies; 4+ messages in thread
From: Krzysztof Wilczyński @ 2021-03-26  6:40 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux PCI, Linux ACPI, LKML, Bjorn Helgaas, Mika Westerberg, David Box

Hi,

[...]
> 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!

Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

Krzysztof

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: ACPI: PM: Fix debug message in acpi_pci_set_power_state()
  2021-03-25 18:57 [PATCH] PCI: ACPI: PM: Fix debug message in acpi_pci_set_power_state() Rafael J. Wysocki
  2021-03-26  6:40 ` Krzysztof Wilczyński
@ 2021-03-31 21:08 ` Bjorn Helgaas
  2021-04-01 10:46   ` Rafael J. Wysocki
  1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2021-03-31 21:08 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linux PCI, Linux ACPI, LKML, Mika Westerberg, David Box,
	Krzysztof Wilczyński

On Thu, Mar 25, 2021 at 07:57:51PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> 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.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

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.

> ---
>  drivers/pci/pci-acpi.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: linux-pm/drivers/pci/pci-acpi.c
> ===================================================================
> --- linux-pm.orig/drivers/pci/pci-acpi.c
> +++ 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;
>  }
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: ACPI: PM: Fix debug message in acpi_pci_set_power_state()
  2021-03-31 21:08 ` Bjorn Helgaas
@ 2021-04-01 10:46   ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-04-01 10:46 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Rafael J. Wysocki, Linux PCI, Linux ACPI, LKML, Mika Westerberg,
	David Box, Krzysztof Wilczyński

On Wed, Mar 31, 2021 at 11:09 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> On Thu, Mar 25, 2021 at 07:57:51PM +0100, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > 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.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> 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!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-04-01 10:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-25 18:57 [PATCH] PCI: ACPI: PM: Fix debug message in acpi_pci_set_power_state() Rafael J. Wysocki
2021-03-26  6:40 ` Krzysztof Wilczyński
2021-03-31 21:08 ` Bjorn Helgaas
2021-04-01 10:46   ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).