net: phy: fixed link

Antony Pavlov antonynpavlov at gmail.com
Mon Aug 8 09:32:03 PDT 2016


Hi Sascha!

I have just took a look on Lukas' 
'net: phy: fixed-link: read link parameters from devicetree' patch.
I see two problems with current 'of_phy_register_fixed_link()' implementation
unrelated to Lukas' changes.

Please see current of_phy_register_fixed_link() implementation:

        static struct phy_device *of_phy_register_fixed_link(struct device_node *np,
                                                struct eth_device *edev)
        {
                struct phy_device *phydev;

                phydev = phy_device_create(NULL, 0, 0);

                phydev->dev.parent = &edev->dev;
                phydev->registered = 1;
                phydev->speed = 1000;
                phydev->duplex = 1;
                phydev->pause = phydev->asym_pause = 0;
                phydev->link = 1;

                return phydev;
        }

1. (a trivial think) the line

        phydev->link = 1;

is redundant because phy_device_create() has already set it.

2. (not so trivial think) the line

       phydev->registered = 1;

Why we want to set phydev->registered here? Can we use phy_register_device() instead?

Any sugesstions?

-- 
Best regards,
  Antony Pavlov



More information about the barebox mailing list