From: "Saheed O. Bolarinwa" <refactormyself@gmail.com>
To: helgaas@kernel.org
Cc: "Saheed O. Bolarinwa" <refactormyself@gmail.com>,
linux-kernel-mentees@lists.linuxfoundation.org
Subject: [Linux-kernel-mentees] [RFC PATCH v5 15/23] PCI: Replace pcie_link_state based device list with a pci_dev one
Date: Sat, 22 Aug 2020 22:03:50 +0200 [thread overview]
Message-ID: <20200822200358.252967-16-refactormyself@gmail.com> (raw)
In-Reply-To: <20200822200358.252967-1-refactormyself@gmail.com>
- Replace existing pcie_link_state based device list with one
based on struct pci_dev one.
- Remove initialisation and declaration of existing list.
- Replace pcie_link_state.sibling with pci_dev.sibling.
- Remove pcie_link_state.sibling.
Signed-off-by: Saheed O. Bolarinwa <refactormyself@gmail.com>
---
drivers/pci/pcie/aspm.c | 27 +++++++++++----------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index 6f73eb2ca0bd..9ca06f00e98d 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -46,7 +46,6 @@ struct pcie_link_state {
struct pci_dev *downstream; /* Downstream component, function 0 */
struct pcie_link_state *root; /* pointer to the root port link */
struct pcie_link_state *parent; /* pointer to the parent Link state */
- struct list_head sibling; /* node in link_list */
/* ASPM state */
u32 aspm_support:7; /* Supported ASPM state */
@@ -74,7 +73,6 @@ struct pcie_link_state {
static int aspm_disabled, aspm_force;
static bool aspm_support_enabled = true;
static DEFINE_MUTEX(aspm_lock);
-static LIST_HEAD(link_list);
static LIST_HEAD(pdev_link_list);
#define POLICY_DEFAULT 0 /* BIOS default setting */
@@ -856,7 +854,6 @@ static int alloc_pcie_link_state(struct pci_dev *pdev)
if (!link)
return -1;
- INIT_LIST_HEAD(&link->sibling);
INIT_LIST_HEAD(&pdev->sibling);
link->pdev = pdev;
link->downstream = pci_function_0(pdev->subordinate);
@@ -889,7 +886,6 @@ static int alloc_pcie_link_state(struct pci_dev *pdev)
pdev->root = pdev->parent->root;
}
- list_add(&link->sibling, &link_list);
list_add(&pdev->sibling, &pdev_link_list);
pdev->link_state = link;
return 0;
@@ -975,20 +971,19 @@ void pcie_aspm_init_link_state(struct pci_dev *pdev)
}
/* Recheck latencies and update aspm_capable for links under the root */
-static void pcie_update_aspm_capable(struct pci_dev *root_pdev)
+static void pcie_update_aspm_capable(struct pci_dev *root)
{
- struct pcie_link_state *root = root_pdev->link_state;
- struct pcie_link_state *link;
+ struct pci_dev *link;
+
BUG_ON(root->parent);
- list_for_each_entry(link, &link_list, sibling) {
+ list_for_each_entry(link, &pdev_link_list, sibling) {
if (link->root != root)
continue;
link->aspm_capable = link->aspm_support;
- link->pdev->aspm_capable = link->aspm_support;
}
- list_for_each_entry(link, &link_list, sibling) {
+ list_for_each_entry(link, &pdev_link_list, sibling) {
struct pci_dev *child;
- struct pci_bus *linkbus = link->pdev->subordinate;
+ struct pci_bus *linkbus = link->subordinate;
if (link->root != root)
continue;
list_for_each_entry(child, &linkbus->devices, bus_list) {
@@ -1024,7 +1019,7 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
/* All functions are removed, so just disable ASPM for the link */
pcie_config_aspm_link(parent, 0);
- list_del(&link->sibling);
+ list_del(&link->pdev->sibling);
/* Clock PM is for endpoint device */
free_link_state(parent);
@@ -1177,7 +1172,7 @@ static int pcie_aspm_set_policy(const char *val,
const struct kernel_param *kp)
{
int i;
- struct pcie_link_state *link;
+ struct pci_dev *link;
if (aspm_disabled)
return -EPERM;
@@ -1190,9 +1185,9 @@ static int pcie_aspm_set_policy(const char *val,
down_read(&pci_bus_sem);
mutex_lock(&aspm_lock);
aspm_policy = i;
- list_for_each_entry(link, &link_list, sibling) {
- pcie_config_aspm_link(link->pdev, policy_to_aspm_state(link->pdev));
- pcie_set_clkpm(link->pdev, policy_to_clkpm_state(link->pdev));
+ list_for_each_entry(link, &pdev_link_list, sibling) {
+ pcie_config_aspm_link(link, policy_to_aspm_state(link));
+ pcie_set_clkpm(link, policy_to_clkpm_state(link));
}
mutex_unlock(&aspm_lock);
up_read(&pci_bus_sem);
--
2.18.4
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2020-08-22 21:04 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-22 20:03 [Linux-kernel-mentees] [RFC PATCH v5 00/23] Remove struct pcie_link_state and aspm_register_info Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 01/23] PCI: Migrate ASPM info from struct pcie_link_state to struct pci_dev Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 02/23] PCI: Add l1ss_cap and l1ss_cap_ptr " Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 03/23] PCI: Rework calc_l*_latency() to take a pci_dev * Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 04/23] PCI: Compute aspm_register_info.support directly Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 05/23] PCI: Read value of aspm_register_info.l1ss_ctl1 directly Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 06/23] PCI: Replace aspm_register_info.l1ss_cap* with their pci_dev version Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 07/23] PCI: Compute aspm_register_info.enable directly Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 08/23] PCI: Remove unused aspm_calc_l1ss_info() arguments Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 09/23] PCI: Remove pcie_get_aspm_reg() and struct aspm_register_info Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 10/23] PCI: Relocate call to aspm_calc_l1ss_info Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 11/23] PCI: Rework and Rename aspm_calc_l1ss_info() Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 12/23] PCI: Add ASPM and CLOCK PM states to struct pci_dev Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 13/23] PCI: Initialise and Update values of pci_dev's PCIe link info Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 14/23] PCI: Change Return and Argument values from pcie_link_state to pci_dev Saheed O. Bolarinwa
2020-08-22 20:03 ` Saheed O. Bolarinwa [this message]
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 16/23] PCI: Remove Exit latencies from struct pcie_link_state Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 17/23] PCI: Remove .clkpm_* " Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 18/23] PCI: Remove .aspm_* " Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 19/23] PCI: Remove .parent " Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 20/23] PCI: Remove .root " Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 21/23] PCI: Remove .downstream " Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 22/23] PCI: Remove .pdev " Saheed O. Bolarinwa
2020-08-22 20:03 ` [Linux-kernel-mentees] [RFC PATCH v5 23/23] PCI: Remove " 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=20200822200358.252967-16-refactormyself@gmail.com \
--to=refactormyself@gmail.com \
--cc=helgaas@kernel.org \
--cc=linux-kernel-mentees@lists.linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.