From: Heiner Kallweit <hkallweit1@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
David Miller <davem@davemloft.net>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: [PATCH net-next 1/2] net: phy: add helper phy_config_aneg
Date: Wed, 11 Jul 2018 22:30:27 +0200 [thread overview]
Message-ID: <cff2a19d-09c1-43fe-ab9a-ce1631d5c18c@gmail.com> (raw)
In-Reply-To: <0d031081-4a7f-ddde-87c0-2c1c6be543c3@gmail.com>
This functionality will also be needed in subsequent patches of this
series, therefore factor it out to a helper.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/phy.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 537297d2..c4aa360d 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -467,6 +467,14 @@ int phy_mii_ioctl(struct phy_device *phydev, struct ifreq *ifr, int cmd)
}
EXPORT_SYMBOL(phy_mii_ioctl);
+static int phy_config_aneg(struct phy_device *phydev)
+{
+ if (phydev->drv->config_aneg)
+ return phydev->drv->config_aneg(phydev);
+ else
+ return genphy_config_aneg(phydev);
+}
+
/**
* phy_start_aneg_priv - start auto-negotiation for this PHY device
* @phydev: the phy_device struct
@@ -493,10 +501,7 @@ static int phy_start_aneg_priv(struct phy_device *phydev, bool sync)
/* Invalidate LP advertising flags */
phydev->lp_advertising = 0;
- if (phydev->drv->config_aneg)
- err = phydev->drv->config_aneg(phydev);
- else
- err = genphy_config_aneg(phydev);
+ err = phy_config_aneg(phydev);
if (err < 0)
goto out_unlock;
--
2.18.0
next prev parent reply other threads:[~2018-07-11 20:37 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 20:29 [PATCH net-next 0/2] net: phy: add functionality to speed down PHY when waiting for WoL packet Heiner Kallweit
2018-07-11 20:30 ` Heiner Kallweit [this message]
2018-07-11 20:38 ` [PATCH net-next 1/2] net: phy: add helper phy_config_aneg Andrew Lunn
2018-07-11 21:04 ` Florian Fainelli
2018-07-11 20:31 ` [PATCH net-next 2/2] net: phy: add phy_speed_down and phy_speed_up Heiner Kallweit
2018-07-11 20:55 ` Andrew Lunn
2018-07-11 21:08 ` Heiner Kallweit
2018-07-11 21:33 ` Florian Fainelli
2018-07-11 21:59 ` Heiner Kallweit
2018-07-12 19:00 ` Heiner Kallweit
2018-07-12 19:09 ` Andrew Lunn
2018-07-12 19:10 ` Heiner Kallweit
2018-07-12 19:25 ` Florian Fainelli
2018-07-12 19:53 ` Florian Fainelli
2018-07-12 20:01 ` 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=cff2a19d-09c1-43fe-ab9a-ce1631d5c18c@gmail.com \
--to=hkallweit1@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
/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).