Commit 43262f00 authored by Bolarinwa O. Saheed's avatar Bolarinwa O. Saheed Committed by Bjorn Helgaas

PCI/ASPM: Move pci_function_0() upward

Move pci_function_0() earlier so we can use it from other functions.

Link: https://lore.kernel.org/r/20211119193732.12343-2-refactormyself@gmail.comSigned-off-by: default avatarBolarinwa O. Saheed <refactormyself@gmail.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent fa55b7dc
...@@ -105,6 +105,20 @@ static const char *policy_str[] = { ...@@ -105,6 +105,20 @@ static const char *policy_str[] = {
#define LINK_RETRAIN_TIMEOUT HZ #define LINK_RETRAIN_TIMEOUT HZ
/*
* The L1 PM substate capability is only implemented in function 0 in a
* multi function device.
*/
static struct pci_dev *pci_function_0(struct pci_bus *linkbus)
{
struct pci_dev *child;
list_for_each_entry(child, &linkbus->devices, bus_list)
if (PCI_FUNC(child->devfn) == 0)
return child;
return NULL;
}
static int policy_to_aspm_state(struct pcie_link_state *link) static int policy_to_aspm_state(struct pcie_link_state *link)
{ {
switch (aspm_policy) { switch (aspm_policy) {
...@@ -423,20 +437,6 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint) ...@@ -423,20 +437,6 @@ static void pcie_aspm_check_latency(struct pci_dev *endpoint)
} }
} }
/*
* The L1 PM substate capability is only implemented in function 0 in a
* multi function device.
*/
static struct pci_dev *pci_function_0(struct pci_bus *linkbus)
{
struct pci_dev *child;
list_for_each_entry(child, &linkbus->devices, bus_list)
if (PCI_FUNC(child->devfn) == 0)
return child;
return NULL;
}
static void pci_clear_and_set_dword(struct pci_dev *pdev, int pos, static void pci_clear_and_set_dword(struct pci_dev *pdev, int pos,
u32 clear, u32 set) u32 clear, u32 set)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment