linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Saheed O. Bolarinwa" <refactormyself@gmail.com>
To: helgaas@kernel.org
Cc: "Saheed O. Bolarinwa" <refactormyself@gmail.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH v2 1/3] PCI/ASPM: Merge pcie_set_clkpm_nocheck() into pcie_set_clkpm()
Date: Sat,  6 Nov 2021 18:55:44 +0100	[thread overview]
Message-ID: <20211106175546.27785-2-refactormyself@gmail.com> (raw)
In-Reply-To: <20211106175546.27785-1-refactormyself@gmail.com>

pcie_set_clkpm_nocheck() is only called from pcie_set_clkpm().

Merge the two functions

Signed-off-by: Saheed O. Bolarinwa <refactormyself@gmail.com>
---
 drivers/pci/pcie/aspm.c | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 013a47f587ce..e5202cc16ef0 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -139,21 +139,12 @@ static int policy_to_clkpm_state(struct pcie_link_state *link)
 	return 0;
 }
 
-static void pcie_set_clkpm_nocheck(struct pcie_link_state *link, int enable)
+static void pcie_set_clkpm(struct pcie_link_state *link, int enable)
 {
+	u32 val;
 	struct pci_dev *child;
 	struct pci_bus *linkbus = link->pdev->subordinate;
-	u32 val = enable ? PCI_EXP_LNKCTL_CLKREQ_EN : 0;
-
-	list_for_each_entry(child, &linkbus->devices, bus_list)
-		pcie_capability_clear_and_set_word(child, PCI_EXP_LNKCTL,
-						   PCI_EXP_LNKCTL_CLKREQ_EN,
-						   val);
-	link->clkpm_enabled = !!enable;
-}
 
-static void pcie_set_clkpm(struct pcie_link_state *link, int enable)
-{
 	/*
 	 * Don't enable Clock PM if the link is not Clock PM capable
 	 * or Clock PM is disabled
@@ -163,7 +154,14 @@ static void pcie_set_clkpm(struct pcie_link_state *link, int enable)
 	/* Need nothing if the specified equals to current state */
 	if (link->clkpm_enabled == enable)
 		return;
-	pcie_set_clkpm_nocheck(link, enable);
+
+	val = enable ? PCI_EXP_LNKCTL_CLKREQ_EN : 0;
+	list_for_each_entry(child, &linkbus->devices, bus_list)
+		pcie_capability_clear_and_set_word(child, PCI_EXP_LNKCTL,
+						   PCI_EXP_LNKCTL_CLKREQ_EN,
+						   val);
+
+	link->clkpm_enabled = !!enable;
 }
 
 static void pcie_clkpm_cap_init(struct pcie_link_state *link, int blacklist)
-- 
2.20.1


  reply	other threads:[~2021-11-06 17:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-06 17:55 [RFC PATCH v2 0/3] Remove struct pcie_link_state.clkpm_* Saheed O. Bolarinwa
2021-11-06 17:55 ` Saheed O. Bolarinwa [this message]
2021-11-06 17:55 ` [RFC PATCH v2 2/3] PCI/ASPM: Remove struct pcie_link_state.clkpm_capable Saheed O. Bolarinwa
2021-11-06 17:55 ` [RFC PATCH v2 3/3] PCI/ASPM: Remove struct pcie_link_state.clkpm_enabled Saheed O. Bolarinwa

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=20211106175546.27785-2-refactormyself@gmail.com \
    --to=refactormyself@gmail.com \
    --cc=helgaas@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /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).