From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: Linux PCI <linux-pci@vger.kernel.org>,
Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Keith Busch <keith.busch@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Linux PM <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [PATCH 5/5] PCI / PM: Decode D3cold power state correctly
Date: Mon, 5 Aug 2019 23:14:34 +0200 [thread overview]
Message-ID: <CAJZ5v0iovG=96rz1B_Fcwi0ZMA3GipoW24zOC6JwZhU=5ZhooQ@mail.gmail.com> (raw)
In-Reply-To: <20190805205214.194981-6-helgaas@kernel.org>
On Mon, Aug 5, 2019 at 10:52 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Use pci_power_name() to print pci_power_t correctly. This changes:
>
> "state 0" or "D0" to "D0"
> "state 1" or "D1" to "D1"
> "state 2" or "D2" to "D2"
> "state 3" or "D3" to "D3hot"
> "state 4" or "D4" to "D3cold"
>
> Changes dmesg logging only, no other functional change intended.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
> drivers/pci/pci.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index d8686e3cd5eb..17ae2615ac11 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -834,14 +834,16 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
> return -EINVAL;
>
> /*
> - * Validate current state:
> - * Can enter D0 from any state, but if we can only go deeper
> - * to sleep if we're already in a low power state
> + * Validate transition: We can enter D0 from any state, but if
> + * we're already in a low-power state, we can only go deeper. E.g.,
> + * we can go from D1 to D3, but we can't go directly from D3 to D1;
> + * we'd have to go from D3 to D0, then to D1.
> */
> if (state != PCI_D0 && dev->current_state <= PCI_D3cold
> && dev->current_state > state) {
> - pci_err(dev, "invalid power transition (from state %d to %d)\n",
> - dev->current_state, state);
> + pci_err(dev, "invalid power transition (from %s to %s)\n",
> + pci_power_name(dev->current_state),
> + pci_power_name(state));
> return -EINVAL;
> }
>
> @@ -896,8 +898,8 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
> pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
> dev->current_state = pci_power_state(pmcsr);
> if (dev->current_state != state && printk_ratelimit())
> - pci_info(dev, "Refused to change power state, currently in D%d\n",
> - dev->current_state);
> + pci_info(dev, "refused to change power state (currently %s)\n",
> + pci_power_name(dev->current_state));
>
> /*
> * According to section 5.4.1 of the "PCI BUS POWER MANAGEMENT
> --
> 2.22.0.770.g0f2c4a37fd-goog
>
prev parent reply other threads:[~2019-08-05 21:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-05 20:52 [PATCH 0/5] PCI: Add PCI_ERROR_RESPONSE, check for errors Bjorn Helgaas
2019-08-05 20:52 ` [PATCH 1/5] PCI: Add PCI_ERROR_RESPONSE definition Bjorn Helgaas
2019-08-05 21:16 ` Rafael J. Wysocki
2019-08-05 20:52 ` [PATCH 2/5] PCI / PM: Return error when changing power state from D3cold Bjorn Helgaas
2019-08-05 21:15 ` Rafael J. Wysocki
2019-08-05 20:52 ` [PATCH 3/5] PCI / PM: Check for error when reading PME status Bjorn Helgaas
2019-08-05 21:02 ` Rafael J. Wysocki
2019-08-06 13:36 ` Bjorn Helgaas
2019-08-13 23:26 ` Rafael J. Wysocki
2019-08-14 1:15 ` Bjorn Helgaas
2019-08-05 20:52 ` [PATCH 4/5] PCI / PM: Check for error when reading Power State Bjorn Helgaas
2019-08-05 21:09 ` Rafael J. Wysocki
2019-08-09 22:01 ` Bjorn Helgaas
2019-08-13 22:59 ` Rafael J. Wysocki
2019-08-14 1:08 ` Bjorn Helgaas
2019-08-05 20:52 ` [PATCH 5/5] PCI / PM: Decode D3cold power state correctly Bjorn Helgaas
2019-08-05 21:14 ` Rafael J. Wysocki [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJZ5v0iovG=96rz1B_Fcwi0ZMA3GipoW24zOC6JwZhU=5ZhooQ@mail.gmail.com' \
--to=rafael@kernel.org \
--cc=bhelgaas@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=helgaas@kernel.org \
--cc=keith.busch@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=mika.westerberg@linux.intel.com \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).