r8169: use tp_to_dev instead of open code
authorJuhee Kang <claudiajkang@gmail.com>
Tue, 29 Nov 2022 16:12:44 +0000 (01:12 +0900)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 1 Dec 2022 12:54:44 +0000 (13:54 +0100)
The open code is defined as a helper function(tp_to_dev) on r8169_main.c,
which the open code is &tp->pci_dev->dev. The helper function was added
in commit 1e1205b7d3e9 ("r8169: add helper tp_to_dev"). And then later,
commit f1e911d5d0df ("r8169: add basic phylib support") added
r8169_phylink_handler function but it didn't use the helper function.
Thus, tp_to_dev() replaces the open code. This patch doesn't change logic.

Signed-off-by: Juhee Kang <claudiajkang@gmail.com>
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
Link: https://lore.kernel.org/r/20221129161244.5356-1-claudiajkang@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/ethernet/realtek/r8169_main.c

index 5bc1181f829b16cc92aa65f63558f3c0e785fa06..ec157885da13c343699dafbe808dcbad1c8aba91 100644 (file)
@@ -4559,12 +4559,13 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
 static void r8169_phylink_handler(struct net_device *ndev)
 {
        struct rtl8169_private *tp = netdev_priv(ndev);
+       struct device *d = tp_to_dev(tp);
 
        if (netif_carrier_ok(ndev)) {
                rtl_link_chg_patch(tp);
-               pm_request_resume(&tp->pci_dev->dev);
+               pm_request_resume(d);
        } else {
-               pm_runtime_idle(&tp->pci_dev->dev);
+               pm_runtime_idle(d);
        }
 
        phy_print_status(tp->phydev);