public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maxime Chevallier <maxime.chevallier@bootlin.com>
To: Oleksij Rempel <o.rempel@pengutronix.de>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Woojung Huh <woojung.huh@microchip.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Russell King <rmk+kernel@armlinux.org.uk>,
	Thangaraj Samynathan <Thangaraj.S@microchip.com>,
	Rengarajan Sundararajan <Rengarajan.S@microchip.com>,
	kernel@pengutronix.de, linux-kernel@vger.kernel.org,
	netdev@vger.kernel.org, UNGLinuxDriver@microchip.com,
	Phil Elwell <phil@raspberrypi.org>
Subject: Re: [PATCH net-next v3 5/7] net: usb: lan78xx: port link settings to phylink API
Date: Tue, 11 Mar 2025 18:11:20 +0100	[thread overview]
Message-ID: <20250311181120.604c0a49@fedora.home> (raw)
In-Reply-To: <20250310115737.784047-6-o.rempel@pengutronix.de>

Hello Oleksij,

On Mon, 10 Mar 2025 12:57:35 +0100
Oleksij Rempel <o.rempel@pengutronix.de> wrote:

> Refactor lan78xx_get_link_ksettings and lan78xx_set_link_ksettings to
> use the phylink API (phylink_ethtool_ksettings_get and
> phylink_ethtool_ksettings_set) instead of directly interfacing with the
> PHY. This change simplifies the code and ensures better integration with
> the phylink framework for link management.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  drivers/net/usb/lan78xx.c | 34 ++--------------------------------
>  1 file changed, 2 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> index 73f62c3e5c58..7107eaa440e5 100644
> --- a/drivers/net/usb/lan78xx.c
> +++ b/drivers/net/usb/lan78xx.c
> @@ -1862,46 +1862,16 @@ static int lan78xx_get_link_ksettings(struct net_device *net,
>  				      struct ethtool_link_ksettings *cmd)
>  {
>  	struct lan78xx_net *dev = netdev_priv(net);
> -	struct phy_device *phydev = net->phydev;
> -	int ret;
> -
> -	ret = usb_autopm_get_interface(dev->intf);
> -	if (ret < 0)
> -		return ret;
>  
> -	phy_ethtool_ksettings_get(phydev, cmd);
> -
> -	usb_autopm_put_interface(dev->intf);
> -
> -	return ret;
> +	return phylink_ethtool_ksettings_get(dev->phylink, cmd);
>  }
>  
>  static int lan78xx_set_link_ksettings(struct net_device *net,
>  				      const struct ethtool_link_ksettings *cmd)
>  {
>  	struct lan78xx_net *dev = netdev_priv(net);
> -	struct phy_device *phydev = net->phydev;
> -	int ret = 0;
> -	int temp;
> -
> -	ret = usb_autopm_get_interface(dev->intf);
> -	if (ret < 0)
> -		return ret;

It is unclear to me why these usb_autopm_* calls are here in the first
place. I think we only need to make sure that the mdio accesses are done
under usb_autopm_get_interface(), which is already the case.

> -	/* change speed & duplex */
> -	ret = phy_ethtool_ksettings_set(phydev, cmd);
>  
> -	if (!cmd->base.autoneg) {
> -		/* force link down */
> -		temp = phy_read(phydev, MII_BMCR);
> -		phy_write(phydev, MII_BMCR, temp | BMCR_LOOPBACK);
> -		mdelay(1);
> -		phy_write(phydev, MII_BMCR, temp);
> -	}
> -
> -	usb_autopm_put_interface(dev->intf);
> -
> -	return ret;
> +	return phylink_ethtool_ksettings_set(dev->phylink, cmd);
>  }
>  
>  static void lan78xx_get_pause(struct net_device *net,

If you need to respin maybe add something about it in the commit,
but besides that,

Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>

Maxime

  reply	other threads:[~2025-03-11 17:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10 11:57 [PATCH net-next v3 0/7] Convert LAN78xx to PHYLINK Oleksij Rempel
2025-03-10 11:57 ` [PATCH net-next v3 1/7] net: usb: lan78xx: Convert to PHYlink for improved PHY and MAC management Oleksij Rempel
2025-03-15  3:48   ` kernel test robot
2025-03-17 15:36   ` Simon Horman
2025-03-18  5:07     ` Oleksij Rempel
2025-03-10 11:57 ` [PATCH net-next v3 2/7] net: usb: lan78xx: improve error reporting on PHY attach failure Oleksij Rempel
2025-03-10 11:57 ` [PATCH net-next v3 3/7] net: usb: lan78xx: Improve error handling for PHY init path Oleksij Rempel
2025-03-10 11:57 ` [PATCH net-next v3 4/7] net: usb: lan78xx: Use ethtool_op_get_link to reflect current link status Oleksij Rempel
2025-03-11 17:04   ` Maxime Chevallier
2025-03-10 11:57 ` [PATCH net-next v3 5/7] net: usb: lan78xx: port link settings to phylink API Oleksij Rempel
2025-03-11 17:11   ` Maxime Chevallier [this message]
2025-03-15  7:16   ` kernel test robot
2025-03-10 11:57 ` [PATCH net-next v3 6/7] net: usb: lan78xx: Transition get/set_pause to phylink Oleksij Rempel
2025-03-11 17:31   ` Maxime Chevallier
2025-03-15 10:58   ` kernel test robot
2025-03-10 11:57 ` [PATCH net-next v3 7/7] net: usb: lan78xx: Integrate EEE support with phylink LPI API Oleksij Rempel

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=20250311181120.604c0a49@fedora.home \
    --to=maxime.chevallier@bootlin.com \
    --cc=Rengarajan.S@microchip.com \
    --cc=Thangaraj.S@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=o.rempel@pengutronix.de \
    --cc=pabeni@redhat.com \
    --cc=phil@raspberrypi.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=woojung.huh@microchip.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