[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201217082804.GB19657@lsv03152.swis.in-blr01.nxp.com>
Date: Thu, 17 Dec 2020 13:58:04 +0530
From: Calvin Johnson <calvin.johnson@....nxp.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Grant Likely <grant.likely@....com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Jeremy Linton <jeremy.linton@....com>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Russell King - ARM Linux admin <linux@...linux.org.uk>,
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>, "linux.cj" <linux.cj@...il.com>,
Laurentiu Tudor <laurentiu.tudor@....com>,
Diana Madalina Craciun <diana.craciun@....com>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
netdev <netdev@...r.kernel.org>,
"David S. Miller" <davem@...emloft.net>,
Heiner Kallweit <hkallweit1@...il.com>,
Jakub Kicinski <kuba@...nel.org>
Subject: Re: [net-next PATCH v2 04/14] net: phy: Introduce fwnode_get_phy_id()
On Tue, Dec 15, 2020 at 07:28:10PM +0200, Andy Shevchenko wrote:
> On Tue, Dec 15, 2020 at 6:44 PM Calvin Johnson
> <calvin.johnson@....nxp.com> wrote:
> >
> > Extract phy_id from compatible string. This will be used by
> > fwnode_mdiobus_register_phy() to create phy device using the
> > phy_id.
>
> ...
>
> > + if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) == 2) {
> > + *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF);
> > + return 0;
> > + }
> > + return -EINVAL;
>
> Perhaps traditional pattern, i.e.
> if (sscanf(cp, "ethernet-phy-id%4x.%4x", &upper, &lower) != 2)
> return -EINVAL;
>
> *phy_id = ((upper & 0xFFFF) << 16) | (lower & 0xFFFF);
> return 0;
>
> And perhaps GENMASK() ?
Sure. Will rewrite accordingly.
Thanks
Calvin
Powered by blists - more mailing lists