Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1445874

Re: [PATCH 2/2] net: ethernet: marvell: pxa168_eth: use phy_ethtool_{get|set}_link_ksettings

From Florian Fainelli <f.fainelli@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] net: ethernet: marvell: pxa168_eth: use phy_ethtool_{get|set}_link_ksettings
Date 2016-07-19 00:10 +0200
Message-ID <rWoTF-3Fq-49@gated-at.bofh.it> (permalink)
References <rW1X3-5S0-5@gated-at.bofh.it> <rW1X3-5S0-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 07/17/2016 02:30 PM, Philippe Reynes wrote:
> There are two generics functions phy_ethtool_{get|set}_link_ksettings,
> so we can use them instead of defining the same code in the driver.
> 
> Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
> ---
> -	cmd.phy_address = pep->phy_addr;
> -	cmd.speed = pep->phy_speed;
> -	cmd.duplex = pep->phy_duplex;
> -	cmd.advertising = PHY_BASIC_FEATURES;
> -	cmd.autoneg = AUTONEG_ENABLE;
> +	cmd.base.phy_address = pep->phy_addr;
> +	cmd.base.speed = pep->phy_speed;
> +	cmd.base.duplex = pep->phy_duplex;
> +	ethtool_convert_legacy_u32_to_link_mode(cmd.link_modes.advertising,
> +						PHY_BASIC_FEATURES);
> +	cmd.base.autoneg = AUTONEG_ENABLE;
>  
> -	if (cmd.speed != 0)
> -		cmd.autoneg = AUTONEG_DISABLE;
> +	if (cmd.base.speed != 0)
> +		cmd.base.autoneg = AUTONEG_DISABLE;
>  
> -	return pxa168_set_settings(dev, &cmd);
> +	return phy_ethtool_set_link_ksettings(dev, &cmd);

This duplicates quite a bit of code that the core PHYLIB already deals
with, you should plan for a subsequent cleanup patch which removes all
of this.
-- 
Florian

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] net: ethernet: marvell: pxa168_eth: use phy_ethtool_{get|set}_link_ksettings Philippe Reynes <tremyfr@gmail.com> - 2016-07-17 23:40 +0200
  Re: [PATCH 2/2] net: ethernet: marvell: pxa168_eth: use  phy_ethtool_{get|set}_link_ksettings David Miller <davem@davemloft.net> - 2016-07-18 08:30 +0200
  Re: [PATCH 2/2] net: ethernet: marvell: pxa168_eth: use  phy_ethtool_{get|set}_link_ksettings Florian Fainelli <f.fainelli@gmail.com> - 2016-07-19 00:10 +0200

csiph-web