Blob Blame History Raw
From 4c867e36b89e820d6ddd901cc75b943a1e511be4 Mon Sep 17 00:00:00 2001
From: Heiner Kallweit <hkallweit1@gmail.com>
Date: Thu, 9 Jan 2020 20:28:08 +0100
Subject: [PATCH] r8169: change argument type of RTL8168g-specific PHY config functions
Git-commit: 4c867e36b89e820d6ddd901cc75b943a1e511be4
Patch-mainline: v5.6-rc1
References: bsc#1175746

These functions use only the phy_device member of rtl8169_private,
so we can pass the phy_device as parameter directly.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 drivers/net/ethernet/realtek/r8169_main.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index dcb6fedf8380..94bad2b09293 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -3058,15 +3058,13 @@ static void rtl8411_hw_phy_config(struct rtl8169_private *tp,
 	rtl_writephy(tp, 0x1f, 0x0000);
 }
 
-static void rtl8168g_disable_aldps(struct rtl8169_private *tp)
+static void rtl8168g_disable_aldps(struct phy_device *phydev)
 {
-	phy_modify_paged(tp->phydev, 0x0a43, 0x10, BIT(2), 0);
+	phy_modify_paged(phydev, 0x0a43, 0x10, BIT(2), 0);
 }
 
-static void rtl8168g_phy_adjust_10m_aldps(struct rtl8169_private *tp)
+static void rtl8168g_phy_adjust_10m_aldps(struct phy_device *phydev)
 {
-	struct phy_device *phydev = tp->phydev;
-
 	phy_modify_paged(phydev, 0x0bcc, 0x14, BIT(8), 0);
 	phy_modify_paged(phydev, 0x0a44, 0x11, 0, BIT(7) | BIT(6));
 	r8168g_phy_param(phydev, 0x8084, 0x6000, 0x0000);
@@ -3095,7 +3093,7 @@ static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp,
 	/* Enable PHY auto speed down */
 	phy_modify_paged(phydev, 0x0a44, 0x11, 0, BIT(3) | BIT(2));
 
-	rtl8168g_phy_adjust_10m_aldps(tp);
+	rtl8168g_phy_adjust_10m_aldps(phydev);
 
 	/* EEE auto-fallback function */
 	phy_modify_paged(phydev, 0x0a4b, 0x11, 0, BIT(2));
@@ -3117,7 +3115,7 @@ static void rtl8168g_1_hw_phy_config(struct rtl8169_private *tp,
 	rtl_writephy(tp, 0x14, 0x1065);
 	rtl_writephy(tp, 0x1f, 0x0000);
 
-	rtl8168g_disable_aldps(tp);
+	rtl8168g_disable_aldps(phydev);
 	rtl8168g_config_eee_phy(phydev);
 }
 
@@ -3190,7 +3188,7 @@ static void rtl8168h_1_hw_phy_config(struct rtl8169_private *tp,
 	/* disable phy pfm mode */
 	phy_modify_paged(phydev, 0x0a44, 0x11, BIT(7), 0);
 
-	rtl8168g_disable_aldps(tp);
+	rtl8168g_disable_aldps(phydev);
 	rtl8168h_config_eee_phy(phydev);
 }
 
@@ -3244,7 +3242,7 @@ static void rtl8168h_2_hw_phy_config(struct rtl8169_private *tp,
 	/* disable phy pfm mode */
 	phy_modify_paged(phydev, 0x0a44, 0x11, BIT(7), 0);
 
-	rtl8168g_disable_aldps(tp);
+	rtl8168g_disable_aldps(phydev);
 	rtl8168g_config_eee_phy(phydev);
 }
 
@@ -3254,7 +3252,7 @@ static void rtl8168ep_1_hw_phy_config(struct rtl8169_private *tp,
 	/* Enable PHY auto speed down */
 	phy_modify_paged(phydev, 0x0a44, 0x11, 0, BIT(3) | BIT(2));
 
-	rtl8168g_phy_adjust_10m_aldps(tp);
+	rtl8168g_phy_adjust_10m_aldps(phydev);
 
 	/* Enable EEE auto-fallback function */
 	phy_modify_paged(phydev, 0x0a4b, 0x11, 0, BIT(2));
@@ -3265,14 +3263,14 @@ static void rtl8168ep_1_hw_phy_config(struct rtl8169_private *tp,
 	/* set rg_sel_sdm_rate */
 	phy_modify_paged(phydev, 0x0c42, 0x11, BIT(13), BIT(14));
 
-	rtl8168g_disable_aldps(tp);
+	rtl8168g_disable_aldps(phydev);
 	rtl8168g_config_eee_phy(phydev);
 }
 
 static void rtl8168ep_2_hw_phy_config(struct rtl8169_private *tp,
 				      struct phy_device *phydev)
 {
-	rtl8168g_phy_adjust_10m_aldps(tp);
+	rtl8168g_phy_adjust_10m_aldps(phydev);
 
 	/* Enable UC LPF tune function */
 	r8168g_phy_param(phydev, 0x8012, 0x0000, 0x8000);
@@ -3315,7 +3313,7 @@ static void rtl8168ep_2_hw_phy_config(struct rtl8169_private *tp,
 	rtl_writephy(tp, 0x14, 0x1065);
 	rtl_writephy(tp, 0x1f, 0x0000);
 
-	rtl8168g_disable_aldps(tp);
+	rtl8168g_disable_aldps(phydev);
 	rtl8168g_config_eee_phy(phydev);
 }
 
@@ -3353,7 +3351,7 @@ static void rtl8117_hw_phy_config(struct rtl8169_private *tp,
 
 	r8168g_phy_param(phydev, 0x8016, 0x0000, 0x0400);
 
-	rtl8168g_disable_aldps(tp);
+	rtl8168g_disable_aldps(phydev);
 	rtl8168h_config_eee_phy(phydev);
 }
 
-- 
2.16.4