Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] PCI / ACPI / PM: Use correct power state strings in messages
@ 2013-06-13 22:29 Rafael J. Wysocki
  2013-06-14 17:08 ` Bjorn Helgaas
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2013-06-13 22:29 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: LKML, Linux PCI, Linux PM list, ACPI Devel Maling List

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

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.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---

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


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

* Re: [PATCH] PCI / ACPI / PM: Use correct power state strings in messages
  2013-06-13 22:29 [PATCH] PCI / ACPI / PM: Use correct power state strings in messages Rafael J. Wysocki
@ 2013-06-14 17:08 ` Bjorn Helgaas
  2013-06-14 22:28   ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2013-06-14 17:08 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: LKML, Linux PCI, Linux PM list, ACPI Devel Maling List

On Thu, Jun 13, 2013 at 4:29 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>
> 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.
>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>
> 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
> ===================================================================
> --- linux-pm.orig/drivers/pci/pci-acpi.c
> +++ 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;
>  }
>

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

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

* Re: [PATCH] PCI / ACPI / PM: Use correct power state strings in messages
  2013-06-14 17:08 ` Bjorn Helgaas
@ 2013-06-14 22:28   ` Rafael J. Wysocki
  2013-06-14 22:49     ` Bjorn Helgaas
  0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2013-06-14 22:28 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: LKML, Linux PCI, Linux PM list, ACPI Devel Maling List

On Friday, June 14, 2013 11:08:44 AM Bjorn Helgaas wrote:
> On Thu, Jun 13, 2013 at 4:29 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > 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.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> >
> > 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
> > ===================================================================
> > --- linux-pm.orig/drivers/pci/pci-acpi.c
> > +++ 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;
> >  }
> >
> 
> 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


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

* Re: [PATCH] PCI / ACPI / PM: Use correct power state strings in messages
  2013-06-14 22:28   ` Rafael J. Wysocki
@ 2013-06-14 22:49     ` Bjorn Helgaas
  2013-06-14 23:13       ` Rafael J. Wysocki
  0 siblings, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2013-06-14 22:49 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: LKML, Linux PCI, Linux PM list, ACPI Devel Maling List

On Sat, Jun 15, 2013 at 12:28:12AM +0200, Rafael J. Wysocki wrote:
> On Friday, June 14, 2013 11:08:44 AM Bjorn Helgaas wrote:
> > On Thu, Jun 13, 2013 at 4:29 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > >
> > > 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.
> > >
> > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > ---
> > >
> > > 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
> > > ===================================================================
> > > --- linux-pm.orig/drivers/pci/pci-acpi.c
> > > +++ 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;
> > >  }
> > >
> > 
> > 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).

Ah, right, I should have noticed that.

> 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 <rafael.j.wysocki@intel.com>
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)]
    Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
index 6c15d6a..dbdc5f7 100644
--- a/drivers/pci/pci-acpi.c
+++ b/drivers/pci/pci-acpi.c
@@ -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;
 }

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

* Re: [PATCH] PCI / ACPI / PM: Use correct power state strings in messages
  2013-06-14 22:49     ` Bjorn Helgaas
@ 2013-06-14 23:13       ` Rafael J. Wysocki
  0 siblings, 0 replies; 5+ messages in thread
From: Rafael J. Wysocki @ 2013-06-14 23:13 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: LKML, Linux PCI, Linux PM list, ACPI Devel Maling List

On Friday, June 14, 2013 04:49:49 PM Bjorn Helgaas wrote:
> On Sat, Jun 15, 2013 at 12:28:12AM +0200, Rafael J. Wysocki wrote:
> > On Friday, June 14, 2013 11:08:44 AM Bjorn Helgaas wrote:
> > > On Thu, Jun 13, 2013 at 4:29 PM, Rafael J. Wysocki <rjw@sisk.pl> wrote:
> > > > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > >
> > > > 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.
> > > >
> > > > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > > > ---
> > > >
> > > > 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
> > > > ===================================================================
> > > > --- linux-pm.orig/drivers/pci/pci-acpi.c
> > > > +++ 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;
> > > >  }
> > > >
> > > 
> > > 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).
> 
> Ah, right, I should have noticed that.
> 
> > 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


> commit fc6504b3a4dc9beae782a11e6f7c3c4a9f077fb8
> Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 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)]
>     Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
>     Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> 
> diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c
> index 6c15d6a..dbdc5f7 100644
> --- a/drivers/pci/pci-acpi.c
> +++ b/drivers/pci/pci-acpi.c
> @@ -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;
>  }
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

end of thread, other threads:[~2013-06-14 23:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-13 22:29 [PATCH] PCI / ACPI / PM: Use correct power state strings in messages Rafael J. Wysocki
2013-06-14 17:08 ` Bjorn Helgaas
2013-06-14 22:28   ` Rafael J. Wysocki
2013-06-14 22:49     ` Bjorn Helgaas
2013-06-14 23:13       ` 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