On Thu, Jul 2, 2020 at 11:48 AM Ioana Ciornei <ioana.ciornei@xxxxxxx> 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