[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210209150433.GB3248@lsv03152.swis.in-blr01.nxp.com>
Date: Tue, 9 Feb 2021 20:34:33 +0530
From: Calvin Johnson <calvin.johnson@....nxp.com>
To: Russell King - ARM Linux admin <linux@...linux.org.uk>
Cc: Grant Likely <grant.likely@....com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Jeremy Linton <jeremy.linton@....com>,
Andrew Lunn <andrew@...n.ch>,
Andy Shevchenko <andy.shevchenko@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Cristi Sovaiala <cristian.sovaiala@....com>,
Florin Laurentiu Chiculita <florinlaurentiu.chiculita@....com>,
Ioana Ciornei <ioana.ciornei@....com>,
Madalin Bucur <madalin.bucur@....nxp.com>,
Heikki Krogerus <heikki.krogerus@...ux.intel.com>,
Marcin Wojtas <mw@...ihalf.com>,
Pieter Jansen Van Vuuren <pieter.jansenvv@...boosystems.io>,
Jon <jon@...id-run.com>, Saravana Kannan <saravanak@...gle.com>,
Randy Dunlap <rdunlap@...radead.org>,
devicetree@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Diana Madalina Craciun <diana.craciun@....com>,
linux-acpi@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
linux.cj@...il.com, Jakub Kicinski <kuba@...nel.org>,
Heiner Kallweit <hkallweit1@...il.com>,
Frank Rowand <frowand.list@...il.com>,
"David S. Miller" <davem@...emloft.net>,
linux-arm-kernel@...ts.infradead.org,
Laurentiu Tudor <laurentiu.tudor@....com>
Subject: Re: [net-next PATCH v5 07/15] net: mdiobus: Introduce
fwnode_mdiobus_register_phy()
On Mon, Feb 08, 2021 at 05:40:13PM +0000, Russell King - ARM Linux admin wrote:
> On Mon, Feb 08, 2021 at 08:42:36PM +0530, Calvin Johnson wrote:
> > +int fwnode_mdiobus_register_phy(struct mii_bus *bus,
> > + struct fwnode_handle *child, u32 addr)
> > +{
> > + struct mii_timestamper *mii_ts;
>
> If you initialise this to NULL...
>
> > + struct phy_device *phy;
> > + bool is_c45 = false;
> > + u32 phy_id;
> > + int rc;
> > +
> > + if (is_of_node(child)) {
> > + mii_ts = of_find_mii_timestamper(to_of_node(child));
> > + if (IS_ERR(mii_ts))
> > + return PTR_ERR(mii_ts);
> > + }
> > +
> > + rc = fwnode_property_match_string(child, "compatible", "ethernet-phy-ieee802.3-c45");
> > + if (rc >= 0)
> > + is_c45 = true;
> > +
> > + if (is_c45 || fwnode_get_phy_id(child, &phy_id))
> > + phy = get_phy_device(bus, addr, is_c45);
> > + else
> > + phy = phy_device_create(bus, addr, phy_id, 0, NULL);
> > + if (IS_ERR(phy)) {
> > + if (mii_ts && is_of_node(child))
>
> Then you don't need is_of_node() here.
>
> > + /* phy->mii_ts may already be defined by the PHY driver. A
> > + * mii_timestamper probed via the device tree will still have
> > + * precedence.
> > + */
> > + if (mii_ts)
> > + phy->mii_ts = mii_ts;
>
> Should this be moved out of the if() case?
>
> I'm thinking of the future where we may end up adding mii timestamper
> support for ACPI.
Right. I'll take case of these in next version.
Thanks
Calvin
Powered by blists - more mailing lists