Skip to content

Commit f139492

Browse files
ij-intelbjorn-helgaas
authored andcommitted
wifi: ath10k: Use RMW accessors for changing LNKCTL
Don't assume that only the driver would be accessing LNKCTL. ASPM policy changes can trigger write to LNKCTL outside of driver's control. Use RMW capability accessors which does proper locking to avoid losing concurrent updates to the register value. On restore, clear the ASPMC field properly. Suggested-by: Lukas Wunner <lukas@wunner.de> Fixes: 76d870e ("ath10k: enable ASPM") Link: https://lore.kernel.org/r/20230717120503.15276-11-ilpo.jarvinen@linux.intel.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Simon Horman <simon.horman@corigine.com> Acked-by: Kalle Valo <kvalo@kernel.org>
1 parent f5a7ac1 commit f139492

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • drivers/net/wireless/ath/ath10k

drivers/net/wireless/ath/ath10k/pci.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1963,8 +1963,9 @@ static int ath10k_pci_hif_start(struct ath10k *ar)
19631963
ath10k_pci_irq_enable(ar);
19641964
ath10k_pci_rx_post(ar);
19651965

1966-
pcie_capability_write_word(ar_pci->pdev, PCI_EXP_LNKCTL,
1967-
ar_pci->link_ctl);
1966+
pcie_capability_clear_and_set_word(ar_pci->pdev, PCI_EXP_LNKCTL,
1967+
PCI_EXP_LNKCTL_ASPMC,
1968+
ar_pci->link_ctl & PCI_EXP_LNKCTL_ASPMC);
19681969

19691970
return 0;
19701971
}
@@ -2821,8 +2822,8 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar,
28212822

28222823
pcie_capability_read_word(ar_pci->pdev, PCI_EXP_LNKCTL,
28232824
&ar_pci->link_ctl);
2824-
pcie_capability_write_word(ar_pci->pdev, PCI_EXP_LNKCTL,
2825-
ar_pci->link_ctl & ~PCI_EXP_LNKCTL_ASPMC);
2825+
pcie_capability_clear_word(ar_pci->pdev, PCI_EXP_LNKCTL,
2826+
PCI_EXP_LNKCTL_ASPMC);
28262827

28272828
/*
28282829
* Bring the target up cleanly.

0 commit comments

Comments
 (0)