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 <trem...@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