netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Subject: [PATCH net-next 06/11] net: phy: marvell: initialise link partner state earlier
Date: Tue, 17 Dec 2019 13:39:26 +0000	[thread overview]
Message-ID: <E1ihD4Q-0001yt-JM@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20191217133827.GQ25745@shell.armlinux.org.uk>

Move the initialisation of the link partner state earlier, inside
marvell_read_status_page(), so we don't have the same initialisation
scattered amongst the other files.  This is in a similar place to
the genphy implementation, so would result in the same behaviour if
a PHY read error occurs.

This allows us to get rid of marvell_read_status_page_fixed(), which
became a pointless wrapper around genphy_read_status_fixed().

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/marvell.c | 25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 18080d9c0cd9..d57df48b3568 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -1230,8 +1230,6 @@ static int marvell_read_status_page_an(struct phy_device *phydev,
 		if (err < 0)
 			return err;
 
-		phydev->pause = 0;
-		phydev->asym_pause = 0;
 		phy_resolve_aneg_pause(phydev);
 	} else {
 		lpa = phy_read(phydev, MII_LPA);
@@ -1241,8 +1239,6 @@ static int marvell_read_status_page_an(struct phy_device *phydev,
 		/* The fiber link is only 1000M capable */
 		fiber_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, lpa);
 
-		phydev->pause = 0;
-		phydev->asym_pause = 0;
 		if (phydev->duplex == DUPLEX_FULL) {
 			if (!(lpa & LPA_PAUSE_FIBER)) {
 				phydev->pause = 0;
@@ -1279,21 +1275,6 @@ static int marvell_read_status_page_an(struct phy_device *phydev,
 	return 0;
 }
 
-static int marvell_read_status_page_fixed(struct phy_device *phydev)
-{
-	int err;
-
-	err = genphy_read_status_fixed(phydev);
-	if (err < 0)
-		return err;
-
-	phydev->pause = 0;
-	phydev->asym_pause = 0;
-	linkmode_zero(phydev->lp_advertising);
-
-	return 0;
-}
-
 /* marvell_read_status_page
  *
  * Description:
@@ -1319,10 +1300,14 @@ static int marvell_read_status_page(struct phy_device *phydev, int page)
 	if (err)
 		return err;
 
+	linkmode_zero(phydev->lp_advertising);
+	phydev->pause = 0;
+	phydev->asym_pause = 0;
+
 	if (phydev->autoneg == AUTONEG_ENABLE)
 		err = marvell_read_status_page_an(phydev, fiber);
 	else
-		err = marvell_read_status_page_fixed(phydev);
+		err = genphy_read_status_fixed(phydev);
 
 	return err;
 }
-- 
2.20.1


  parent reply	other threads:[~2019-12-17 13:39 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-17 13:38 [PATCH net-next 00/11] phylib consolidation Russell King - ARM Linux admin
2019-12-17 13:39 ` [PATCH net-next 01/11] net: phy: remove redundant .aneg_done initialisers Russell King
2019-12-17 15:35   ` Andrew Lunn
2019-12-17 17:25   ` Florian Fainelli
2019-12-17 13:39 ` [PATCH net-next 02/11] net: phy: use phy_resolve_aneg_pause() Russell King
2019-12-17 15:38   ` Andrew Lunn
2019-12-17 17:26   ` Florian Fainelli
2019-12-17 13:39 ` [PATCH net-next 03/11] net: phy: add genphy_check_and_restart_aneg() Russell King
2019-12-17 15:41   ` Andrew Lunn
2019-12-17 17:27   ` Florian Fainelli
2019-12-17 13:39 ` [PATCH net-next 04/11] net: phy: provide and use genphy_read_status_fixed() Russell King
2019-12-17 15:42   ` Andrew Lunn
2019-12-17 17:27   ` Florian Fainelli
2019-12-17 13:39 ` [PATCH net-next 05/11] net: phy: marvell: rearrange to use genphy_read_lpa() Russell King
2019-12-17 15:44   ` Andrew Lunn
2019-12-17 17:30   ` Florian Fainelli
2019-12-17 13:39 ` Russell King [this message]
2019-12-17 15:45   ` [PATCH net-next 06/11] net: phy: marvell: initialise link partner state earlier Andrew Lunn
2019-12-17 17:30   ` Florian Fainelli
2019-12-17 13:39 ` [PATCH net-next 07/11] net: phy: marvell: use positive logic for link state Russell King
2019-12-17 15:46   ` Andrew Lunn
2019-12-17 17:31   ` Florian Fainelli
2019-12-17 13:39 ` [PATCH net-next 08/11] net: phy: marvell: consolidate phy status reading Russell King
2019-12-17 13:39 ` [PATCH net-next 09/11] net: phy: marvell: use existing clause 37 definitions Russell King
2019-12-17 15:47   ` Andrew Lunn
2019-12-17 17:33   ` Florian Fainelli
2019-12-17 13:39 ` [PATCH net-next 10/11] net: phy: marvell: use phy_modify_changed() Russell King
2019-12-17 15:48   ` Andrew Lunn
2019-12-17 17:35   ` Florian Fainelli
2019-12-17 13:39 ` [PATCH net-next 11/11] net: phy: marvell: use genphy_check_and_restart_aneg() Russell King
2019-12-17 15:48   ` Andrew Lunn
2019-12-17 17:36   ` Florian Fainelli
2019-12-19 20:52 ` [PATCH net-next 00/11] phylib consolidation David Miller

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=E1ihD4Q-0001yt-JM@rmk-PC.armlinux.org.uk \
    --to=rmk+kernel@armlinux.org.uk \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@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).