ath: Use dev_get_drvdata where possible
authorChuhong Yuan <hslester96@gmail.com>
Wed, 24 Jul 2019 11:27:20 +0000 (19:27 +0800)
committerKalle Valo <kvalo@codeaurora.org>
Mon, 23 Sep 2019 08:25:22 +0000 (11:25 +0300)
Instead of using to_pci_dev + pci_get_drvdata,
use dev_get_drvdata to make code simpler.

Signed-off-by: Chuhong Yuan <hslester96@gmail.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath5k/pci.c
drivers/net/wireless/ath/ath9k/pci.c
drivers/net/wireless/ath/wil6210/pcie_bus.c

index c6156cc..e1378e2 100644 (file)
@@ -301,8 +301,7 @@ ath5k_pci_remove(struct pci_dev *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int ath5k_pci_suspend(struct device *dev)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct ieee80211_hw *hw = pci_get_drvdata(pdev);
+       struct ieee80211_hw *hw = dev_get_drvdata(dev);
        struct ath5k_hw *ah = hw->priv;
 
        ath5k_led_off(ah);
index 92b2dd3..f3461b1 100644 (file)
@@ -1021,13 +1021,12 @@ static void ath_pci_remove(struct pci_dev *pdev)
 
 static int ath_pci_suspend(struct device *device)
 {
-       struct pci_dev *pdev = to_pci_dev(device);
-       struct ieee80211_hw *hw = pci_get_drvdata(pdev);
+       struct ieee80211_hw *hw = dev_get_drvdata(device);
        struct ath_softc *sc = hw->priv;
        struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 
        if (test_bit(ATH_OP_WOW_ENABLED, &common->op_flags)) {
-               dev_info(&pdev->dev, "WOW is enabled, bypassing PCI suspend\n");
+               dev_info(device, "WOW is enabled, bypassing PCI suspend\n");
                return 0;
        }
 
index 18dd8b2..f1a2823 100644 (file)
@@ -629,8 +629,7 @@ static int __maybe_unused wil6210_pm_resume(struct device *dev)
 
 static int __maybe_unused wil6210_pm_runtime_idle(struct device *dev)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct wil6210_priv *wil = pci_get_drvdata(pdev);
+       struct wil6210_priv *wil = dev_get_drvdata(dev);
 
        wil_dbg_pm(wil, "Runtime idle\n");
 
@@ -644,8 +643,7 @@ static int __maybe_unused wil6210_pm_runtime_resume(struct device *dev)
 
 static int __maybe_unused wil6210_pm_runtime_suspend(struct device *dev)
 {
-       struct pci_dev *pdev = to_pci_dev(dev);
-       struct wil6210_priv *wil = pci_get_drvdata(pdev);
+       struct wil6210_priv *wil = dev_get_drvdata(dev);
 
        if (test_bit(wil_status_suspended, wil->status)) {
                wil_dbg_pm(wil, "trying to suspend while suspended\n");