forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/drivers/net/wireless/ath/ath9k/pci.c
....@@ -825,6 +825,7 @@
825825 struct pci_dev *pdev = to_pci_dev(sc->dev);
826826 struct pci_dev *parent;
827827 u16 aspm;
828
+ int ret;
828829
829830 if (!ah->is_pciexpress)
830831 return;
....@@ -866,8 +867,8 @@
866867 if (AR_SREV_9462(ah))
867868 pci_read_config_dword(pdev, 0x70c, &ah->config.aspm_l1_fix);
868869
869
- pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm);
870
- if (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1)) {
870
+ ret = pcie_capability_read_word(parent, PCI_EXP_LNKCTL, &aspm);
871
+ if (!ret && (aspm & (PCI_EXP_LNKCTL_ASPM_L0S | PCI_EXP_LNKCTL_ASPM_L1))) {
871872 ah->aspm_enabled = true;
872873 /* Initialize PCIe PM and SERDES registers. */
873874 ath9k_hw_configpcipowersave(ah, false);
....@@ -1021,13 +1022,12 @@
10211022
10221023 static int ath_pci_suspend(struct device *device)
10231024 {
1024
- struct pci_dev *pdev = to_pci_dev(device);
1025
- struct ieee80211_hw *hw = pci_get_drvdata(pdev);
1025
+ struct ieee80211_hw *hw = dev_get_drvdata(device);
10261026 struct ath_softc *sc = hw->priv;
10271027 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
10281028
10291029 if (test_bit(ATH_OP_WOW_ENABLED, &common->op_flags)) {
1030
- dev_info(&pdev->dev, "WOW is enabled, bypassing PCI suspend\n");
1030
+ dev_info(device, "WOW is enabled, bypassing PCI suspend\n");
10311031 return 0;
10321032 }
10331033