[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VdOF2qXFQOAyYVFLY-_JbGUAZ-6Cq-q_LRzKeV69RrJgg@mail.gmail.com>
Date: Thu, 9 Jul 2020 23:48:03 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Calvin Johnson <calvin.johnson@....nxp.com>
Cc: Jeremy Linton <jeremy.linton@....com>,
Russell King - ARM Linux admin <linux@...linux.org.uk>,
Jon <jon@...id-run.com>,
Cristi Sovaiala <cristian.sovaiala@....com>,
Ioana Ciornei <ioana.ciornei@....com>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
Madalin Bucur <madalin.bucur@....nxp.com>,
ACPI Devel Maling List <linux-acpi@...r.kernel.org>,
linux.cj@...il.com, netdev <netdev@...r.kernel.org>
Subject: Re: [net-next PATCH v4 5/6] phylink: introduce phylink_fwnode_phy_connect()
On Thu, Jul 9, 2020 at 8:58 PM Calvin Johnson
<calvin.johnson@....nxp.com> wrote:
>
> Define phylink_fwnode_phy_connect() to connect phy specified by
> a fwnode to a phylink instance.
...
> + if (is_of_node(fwnode)) {
> + ret = phylink_of_phy_connect(pl, to_of_node(fwnode), flags);
> + } else if (is_acpi_device_node(fwnode)) {
> + phy_dev = phy_find_by_fwnode(fwnode);
> + if (!phy_dev)
> + return -ENODEV;
> + ret = phylink_connect_phy(pl, phy_dev);
> + }
Looking at this more I really don't like how this if-else-if looks like.
I would rather expect something like
phy_dev = phy_find_by_fwnode(fwnode);
if (!phy_dev)
return -ENODEV;
ret = phylink_connect_phy(pl, phy_dev);
Where phy_find_by_fwnode() will take care about OF or any other
possible fwnode cases.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists