[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeFBOwN92XKJRZfpJn23bY4CGKxQCCn9n_krwxXtAdtLA@mail.gmail.com>
Date: Thu, 2 Jul 2020 12:34:48 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Ioana Ciornei <ioana.ciornei@....com>
Cc: "Calvin Johnson (OSS)" <calvin.johnson@....nxp.com>,
Jeremy Linton <jeremy.linton@....com>,
Russell King - ARM Linux admin <linux@...linux.org.uk>,
Jon <jon@...id-run.com>,
Cristi Sovaiala <cristian.sovaiala@....com>,
Andrew Lunn <andrew@...n.ch>,
Florian Fainelli <f.fainelli@...il.com>,
"Madalin Bucur (OSS)" <madalin.bucur@....nxp.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-acpi@...r.kernel.org" <linux-acpi@...r.kernel.org>,
"linux.cj@...il.com" <linux.cj@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Ioana Ciocoi Radulescu <ruxandra.radulescu@....com>,
Jakub Kicinski <kuba@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [net-next PATCH v2 3/3] net: dpaa2-mac: Add ACPI support for
DPAA2 MAC driver
On Thu, Jul 2, 2020 at 11:48 AM Ioana Ciornei <ioana.ciornei@....com> wrote:
>
> > Subject: [net-next PATCH v2 3/3] net: dpaa2-mac: Add ACPI support for DPAA2
> > MAC driver
> >
> > Modify dpaa2_mac_connect() to support ACPI along with DT.
> > Modify dpaa2_mac_get_node() to get the dpmac fwnode from either DT or
> > ACPI.
> > Replace of_get_phy_mode with fwnode_get_phy_mode to get phy-mode for a
> > dpmac_node.
> > Define and use helper function find_phy_device() to find phy_dev that is later
> > connected to mac->phylink.
...
> > - while ((dpmac = of_get_next_child(dpmacs, dpmac)) != NULL) {
> > - err = of_property_read_u32(dpmac, "reg", &id);
> > - if (err)
> > - continue;
> > - if (id == dpmac_id)
> > - break;
> > + if (is_of_node(fsl_mc_fwnode)) {
> > + dpmacs = device_get_named_child_node(fsl_mc, "dpmacs");
> > + if (!dpmacs)
> > + return NULL;
> > +
> > + while ((dpmac = fwnode_get_next_child_node(dpmacs,
> > dpmac))) {
> > + err = fwnode_property_read_u32(dpmac, "reg", &id);
> > + if (err)
> > + continue;
> > + if (id == dpmac_id)
> > + return dpmac;
> > + }
> > + } else if (is_acpi_node(fsl_mc_fwnode)) {
> > + adev = acpi_find_child_device(ACPI_COMPANION(dev->parent),
> > + dpmac_id, false);
> > + if (adev)
> > + return (&adev->fwnode);
> > }
> > -
> > - of_node_put(dpmacs);
> > -
>
> This of_node_put() on the 'dpmacs' node still needs to happen for the OF case.
Actually this also raises the question if ACPI case increases refcount
or not and it should be fixed accordingly (Note, we have to take
reference to fwnode before return in ACPI case and drop reference to
adev).
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists