Skip to content

Commit e673d38

Browse files
jhovoldbjorn-helgaas
authored andcommitted
PCI/ASPM: Clean up __pci_disable_link_state() 'sem' parameter
Replace the current 'sem' parameter to the __pci_disable_link_state() helper with a more descriptive 'locked' parameter, which indicates whether a pci_bus_sem read lock is already held. Link: https://lore.kernel.org/r/20231128081512.19387-6-johan+linaro@kernel.org Signed-off-by: Johan Hovold <johan+linaro@kernel.org> [bhelgaas: include function name in subject, commit log] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
1 parent 780f52e commit e673d38

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

drivers/pci/pcie/aspm.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ static struct pcie_link_state *pcie_aspm_get_link(struct pci_dev *pdev)
10411041
return bridge->link_state;
10421042
}
10431043

1044-
static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
1044+
static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool locked)
10451045
{
10461046
struct pcie_link_state *link = pcie_aspm_get_link(pdev);
10471047

@@ -1060,7 +1060,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
10601060
return -EPERM;
10611061
}
10621062

1063-
if (sem)
1063+
if (!locked)
10641064
down_read(&pci_bus_sem);
10651065
mutex_lock(&aspm_lock);
10661066
if (state & PCIE_LINK_STATE_L0S)
@@ -1082,15 +1082,15 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
10821082
link->clkpm_disable = 1;
10831083
pcie_set_clkpm(link, policy_to_clkpm_state(link));
10841084
mutex_unlock(&aspm_lock);
1085-
if (sem)
1085+
if (!locked)
10861086
up_read(&pci_bus_sem);
10871087

10881088
return 0;
10891089
}
10901090

10911091
int pci_disable_link_state_locked(struct pci_dev *pdev, int state)
10921092
{
1093-
return __pci_disable_link_state(pdev, state, false);
1093+
return __pci_disable_link_state(pdev, state, true);
10941094
}
10951095
EXPORT_SYMBOL(pci_disable_link_state_locked);
10961096

@@ -1105,7 +1105,7 @@ EXPORT_SYMBOL(pci_disable_link_state_locked);
11051105
*/
11061106
int pci_disable_link_state(struct pci_dev *pdev, int state)
11071107
{
1108-
return __pci_disable_link_state(pdev, state, true);
1108+
return __pci_disable_link_state(pdev, state, false);
11091109
}
11101110
EXPORT_SYMBOL(pci_disable_link_state);
11111111

0 commit comments

Comments
 (0)