All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Jose Abreu <Jose.Abreu@synopsys.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Cc: Joao Pinto <Joao.Pinto@synopsys.com>,
	"David S . Miller" <davem@davemloft.net>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@st.com>,
	Russell King <linux@armlinux.org.uk>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>
Subject: Re: [RFC net-next 2/2] net: stmmac: Convert to phylink
Date: Fri, 7 Jun 2019 20:58:02 -0700	[thread overview]
Message-ID: <34db7462-4f5a-155a-d230-e4c90cee1ce3@gmail.com> (raw)
In-Reply-To: <2528141fcc644205dc1c0a0f2640da1a0e7d5935.1559741195.git.joabreu@synopsys.com>



On 6/6/2019 4:26 AM, Jose Abreu wrote:
> Convert stmmac driver to phylink.
> 
> Signed-off-by: Jose Abreu <joabreu@synopsys.com>
> Cc: Joao Pinto <jpinto@synopsys.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
> Cc: Alexandre Torgue <alexandre.torgue@st.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Andrew Lunn <andrew@lunn.ch>
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Cc: Heiner Kallweit <hkallweit1@gmail.com>
> ---
[snip]

			     interface);
> -	}
> +	if (node) {
> +		ret = phylink_of_phy_connect(priv->phylink, node, 0);
> +	} else {
> +		int addr = priv->plat->phy_addr;
> +		struct phy_device *phydev;
>  
> -	if (IS_ERR_OR_NULL(phydev)) {
> -		netdev_err(priv->dev, "Could not attach to PHY\n");
> -		if (!phydev)
> +		phydev = mdiobus_get_phy(priv->mii, addr);
> +		if (!phydev) {
> +			netdev_err(priv->dev, "no phy at addr %d\n", addr);
>  			return -ENODEV;
> +		}

I am not exactly sure removing this is strictly equivalent here, but the
diff makes it hard to review.

For the sake of reviewing the code, could you structure the patches like
you did with an intermediate step being:

- prepare for PHYLINK (patch #1)
- add support for PHYLINK (parts of this patch) but without plugging it
into the probe/connect path just yet
- get rid of all PHYLIB related code (parts of this patch), which would
be a new patch #3

AFAIR, there are several cases that stmmac supports today:

- fixed PHY (covered by PHYLINK)
- PHY designated via phy-handle (covered by PHYLINK)
- PHY address via platform data (not covered by PHYLINK unless we add
support for that), with no Device Tree node
- when a MDIO bus Device Tree node is present, register the stmmac MDIO
bus (which you don't change).

I believe I have convinced myself that the third case is covered with
the change above :)

This looks great, thanks!
-- 
Florian

  reply	other threads:[~2019-06-08  3:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-05 13:30 [RFC net-next 0/2] net: stmmac: Convert to phylink Jose Abreu
2019-06-06 11:26 ` Jose Abreu
2019-06-05 13:30 ` [RFC net-next 1/2] net: stmmac: Prepare to convert " Jose Abreu
2019-06-06 11:26   ` Jose Abreu
2019-06-05 13:30 ` [RFC net-next 2/2] net: stmmac: Convert " Jose Abreu
2019-06-06 11:26   ` Jose Abreu
2019-06-08  3:58   ` Florian Fainelli [this message]
2019-06-08 18:46     ` Andrew Lunn

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=34db7462-4f5a-155a-d230-e4c90cee1ce3@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=Joao.Pinto@synopsys.com \
    --cc=Jose.Abreu@synopsys.com \
    --cc=alexandre.torgue@st.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=hkallweit1@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=peppe.cavallaro@st.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.