netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Realtek linux nic maintainers <nic_swsd@realtek.com>,
	David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH net-next 3/6] r8169: change argument type of PHY-related functions
Date: Sat, 24 Mar 2018 23:18:18 +0100	[thread overview]
Message-ID: <8faa29c1-8c49-f6b8-2b71-ab59b4a0d5d3@gmail.com> (raw)
In-Reply-To: <6160c32d-3905-683a-7117-d2b11d310a34@gmail.com>

Some PHY-related functions functions can be a little streamlined and
simplified by taking a struct rtl8169_private * argument.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 0f1c19e8..a0e32557 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -4370,10 +4370,8 @@ static void rtl8106e_hw_phy_config(struct rtl8169_private *tp)
 	rtl_eri_write(tp, 0x1d0, ERIAR_MASK_0011, 0x0000, ERIAR_EXGMAC);
 }
 
-static void rtl_hw_phy_config(struct net_device *dev)
+static void rtl_hw_phy_config(struct rtl8169_private *tp)
 {
-	struct rtl8169_private *tp = netdev_priv(dev);
-
 	rtl8169_print_mac_version(tp);
 
 	switch (tp->mac_version) {
@@ -4546,8 +4544,7 @@ DECLARE_RTL_COND(rtl_phy_reset_cond)
 	return tp->phy_reset_pending(tp);
 }
 
-static void rtl8169_phy_reset(struct net_device *dev,
-			      struct rtl8169_private *tp)
+static void rtl8169_phy_reset(struct rtl8169_private *tp)
 {
 	tp->phy_reset_enable(tp);
 	rtl_msleep_loop_wait_low(tp, &rtl_phy_reset_cond, 1, 100);
@@ -4559,9 +4556,9 @@ static bool rtl_tbi_enabled(struct rtl8169_private *tp)
 	    (RTL_R8(tp, PHYstatus) & TBI_Enable);
 }
 
-static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
+static void rtl8169_init_phy(struct rtl8169_private *tp)
 {
-	rtl_hw_phy_config(dev);
+	rtl_hw_phy_config(tp);
 
 	if (tp->mac_version <= RTL_GIGA_MAC_VER_06) {
 		dprintk("Set MAC Reg C+CR Offset 0x82h = 0x01h\n");
@@ -4580,9 +4577,9 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 		rtl_writephy(tp, 0x0b, 0x0000); //w 0x0b 15 0 0
 	}
 
-	rtl8169_phy_reset(dev, tp);
+	rtl8169_phy_reset(tp);
 
-	rtl8169_set_speed(dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL,
+	rtl8169_set_speed(tp->dev, AUTONEG_ENABLE, SPEED_1000, DUPLEX_FULL,
 			  ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full |
 			  ADVERTISED_100baseT_Half | ADVERTISED_100baseT_Full |
 			  (tp->mii.supports_gmii ?
@@ -4590,7 +4587,7 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 			   ADVERTISED_1000baseT_Full : 0));
 
 	if (rtl_tbi_enabled(tp))
-		netif_info(tp, link, dev, "TBI auto-negotiating\n");
+		netif_info(tp, link, tp->dev, "TBI auto-negotiating\n");
 }
 
 static void rtl_rar_set(struct rtl8169_private *tp, u8 *addr)
@@ -7687,7 +7684,7 @@ static int rtl_open(struct net_device *dev)
 
 	napi_enable(&tp->napi);
 
-	rtl8169_init_phy(dev, tp);
+	rtl8169_init_phy(tp);
 
 	__rtl8169_set_features(dev, dev->features);
 
@@ -7832,7 +7829,7 @@ static int rtl8169_resume(struct device *device)
 	struct net_device *dev = pci_get_drvdata(pdev);
 	struct rtl8169_private *tp = netdev_priv(dev);
 
-	rtl8169_init_phy(dev, tp);
+	rtl8169_init_phy(tp);
 
 	if (netif_running(dev))
 		__rtl8169_resume(dev);
@@ -7880,7 +7877,7 @@ static int rtl8169_runtime_resume(struct device *device)
 	tp->saved_wolopts = 0;
 	rtl_unlock_work(tp);
 
-	rtl8169_init_phy(dev, tp);
+	rtl8169_init_phy(tp);
 
 	__rtl8169_resume(dev);
 
-- 
2.16.2

  parent reply	other threads:[~2018-03-24 22:18 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-24 22:11 [PATCH net-next 0/6] r8169: patch set with further smaller improvements Heiner Kallweit
2018-03-24 22:18 ` [PATCH net-next 1/6] r8169: change argument type of callback hw_start in struct rtl8169_private Heiner Kallweit
2018-03-24 22:18 ` [PATCH net-next 2/6] r8169: change argument type of counter functions Heiner Kallweit
2018-03-24 22:18 ` Heiner Kallweit [this message]
2018-03-24 22:18 ` [PATCH net-next 4/6] r8169: change argument type of interrupt handler Heiner Kallweit
2018-03-24 22:18 ` [PATCH net-next 5/6] r8169: change type of driver_data Heiner Kallweit
2018-03-25 20:43   ` David Miller
2018-03-25 21:29     ` Heiner Kallweit
2018-03-24 22:18 ` [PATCH net-next 6/6] r8169: change argument type of rtl8169_net_suspend and __rtl8169_resume Heiner Kallweit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8faa29c1-8c49-f6b8-2b71-ab59b4a0d5d3@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).