From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux PCI <linux-pci@vger.kernel.org>,
Linux PM <linux-pm@vger.kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH 2/5] PCI: PM: Use pci_power_up() in pci_set_power_state()
Date: Tue, 05 Nov 2019 11:27:49 +0100 [thread overview]
Message-ID: <2520019.OZ1nXS5aSj@kreacher> (raw)
In-Reply-To: <2771503.n70vfTtcVb@kreacher>
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Make it explicitly clear that the code to put devices into D0 in
pci_set_power_state() and in pci_pm_default_resume_early() is the
same by making the latter use pci_power_up() for transitions into
D0.
Code rearrangement, no intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
This is on top of https://patchwork.kernel.org/patch/11223673/
---
drivers/pci/pci.c | 25 +++++++++++++------------
drivers/pci/pci.h | 2 +-
2 files changed, 14 insertions(+), 13 deletions(-)
Index: linux-pm/drivers/pci/pci.c
===================================================================
--- linux-pm.orig/drivers/pci/pci.c
+++ linux-pm/drivers/pci/pci.c
@@ -1033,6 +1033,16 @@ static void __pci_start_power_transition
}
/**
+ * pci_power_up - Put the given device into D0
+ * @dev: PCI device to power up
+ */
+int pci_power_up(struct pci_dev *dev)
+{
+ __pci_start_power_transition(dev, PCI_D0);
+ return pci_raw_set_power_state(dev, PCI_D0);
+}
+
+/**
* __pci_dev_set_current_state - Set current state of a PCI device
* @dev: Device to handle
* @data: pointer to state to be set
@@ -1117,6 +1127,9 @@ int pci_set_power_state(struct pci_dev *
if (dev->current_state == state)
return 0;
+ if (state == PCI_D0)
+ return pci_power_up(dev);
+
/*
* This device is quirked not to be put into D3, so don't put it in
* D3
@@ -1124,8 +1137,6 @@ int pci_set_power_state(struct pci_dev *
if (state >= PCI_D3hot && (dev->dev_flags & PCI_DEV_FLAGS_NO_D3))
return 0;
- __pci_start_power_transition(dev, state);
-
/*
* To put device in D3cold, we put device into D3hot in native
* way, then put device into D3cold with platform ops
@@ -1141,16 +1152,6 @@ int pci_set_power_state(struct pci_dev *
EXPORT_SYMBOL(pci_set_power_state);
/**
- * pci_power_up - Put the given device into D0 forcibly
- * @dev: PCI device to power up
- */
-void pci_power_up(struct pci_dev *dev)
-{
- __pci_start_power_transition(dev, PCI_D0);
- pci_raw_set_power_state(dev, PCI_D0);
-}
-
-/**
* pci_choose_state - Choose the power state of a PCI device
* @dev: PCI device to be suspended
* @state: target sleep state for the whole system. This is the value
Index: linux-pm/drivers/pci/pci.h
===================================================================
--- linux-pm.orig/drivers/pci/pci.h
+++ linux-pm/drivers/pci/pci.h
@@ -85,7 +85,7 @@ struct pci_platform_pm_ops {
int pci_set_platform_pm(const struct pci_platform_pm_ops *ops);
void pci_update_current_state(struct pci_dev *dev, pci_power_t state);
void pci_refresh_power_state(struct pci_dev *dev);
-void pci_power_up(struct pci_dev *dev);
+int pci_power_up(struct pci_dev *dev);
void pci_disable_enabled_device(struct pci_dev *dev);
int pci_finish_runtime_suspend(struct pci_dev *dev);
void pcie_clear_root_pme_status(struct pci_dev *dev);
next prev parent reply other threads:[~2019-11-05 10:32 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 10:11 [PATCH 0/5] PCI: PM: Cleanups related to power state changes Rafael J. Wysocki
2019-11-05 10:13 ` [PATCH 1/5] PCI: PM: Move power state update away from pci_power_up() Rafael J. Wysocki
2019-11-05 10:27 ` Rafael J. Wysocki [this message]
2019-11-05 10:29 ` [PATCH 3/5] PCI: PM: Fold __pci_start_power_transition() into its caller Rafael J. Wysocki
2019-11-05 10:30 ` [PATCH 4/5] PCI: PM: Avoid exporting __pci_complete_power_transition() Rafael J. Wysocki
2019-11-05 10:32 ` [PATCH 5/5] PCI: PM: Fold __pci_complete_power_transition() into its caller Rafael J. Wysocki
2019-11-05 16:09 ` Christoph Hellwig
2019-11-05 16:15 ` Rafael J. Wysocki
2019-11-05 11:28 ` [PATCH 0/5] PCI: PM: Cleanups related to power state changes Rafael J. Wysocki
2019-11-05 22:35 ` Bjorn Helgaas
2019-11-05 22:48 ` Rafael J. Wysocki
2019-11-05 13:02 ` Mika Westerberg
2019-11-05 16:32 ` [PATCH update 5/5] PCI: PM: Fold __pci_complete_power_transition() into its caller Rafael J. Wysocki
2019-11-06 19:02 ` [PATCH 0/5] PCI: PM: Cleanups related to power state changes Bjorn Helgaas
2019-11-07 13:33 ` Rafael J. Wysocki
2019-11-08 11:49 ` Rafael J. Wysocki
2019-11-08 20:13 ` Bjorn Helgaas
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=2520019.OZ1nXS5aSj@kreacher \
--to=rjw@rjwysocki.net \
--cc=helgaas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/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).