mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
PCI: pciehp: Use RMW accessors for changing LNKCTL
[ Upstream commit5f75f96c61] As hotplug is not the only driver touching LNKCTL, use the RMW capability accessor which handles concurrent changes correctly. Suggested-by: Lukas Wunner <lukas@wunner.de> Fixes:7f822999e1("PCI: pciehp: Add Disable/enable link functions") Link: https://lore.kernel.org/r/20230717120503.15276-4-ilpo.jarvinen@linux.intel.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: "Rafael J. Wysocki" <rafael@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f2d7da8faf
commit
952da7c6e1
@@ -332,17 +332,11 @@ int pciehp_check_link_status(struct controller *ctrl)
|
|||||||
static int __pciehp_link_set(struct controller *ctrl, bool enable)
|
static int __pciehp_link_set(struct controller *ctrl, bool enable)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = ctrl_dev(ctrl);
|
struct pci_dev *pdev = ctrl_dev(ctrl);
|
||||||
u16 lnk_ctrl;
|
|
||||||
|
|
||||||
pcie_capability_read_word(pdev, PCI_EXP_LNKCTL, &lnk_ctrl);
|
pcie_capability_clear_and_set_word(pdev, PCI_EXP_LNKCTL,
|
||||||
|
PCI_EXP_LNKCTL_LD,
|
||||||
|
enable ? 0 : PCI_EXP_LNKCTL_LD);
|
||||||
|
|
||||||
if (enable)
|
|
||||||
lnk_ctrl &= ~PCI_EXP_LNKCTL_LD;
|
|
||||||
else
|
|
||||||
lnk_ctrl |= PCI_EXP_LNKCTL_LD;
|
|
||||||
|
|
||||||
pcie_capability_write_word(pdev, PCI_EXP_LNKCTL, lnk_ctrl);
|
|
||||||
ctrl_dbg(ctrl, "%s: lnk_ctrl = %x\n", __func__, lnk_ctrl);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user