Re: [net-next: PATCH v2 3/8] net: dsa: switch to device_/fwnode_ APIs

From: Andy Shevchenko
Date: Fri Jul 15 2022 - 15:25:55 EST


On Fri, Jul 15, 2022 at 10:50:07AM +0200, Marcin Wojtas wrote:
> In order to support both ACPI and DT, modify the generic
> DSA code to use device_/fwnode_ equivalent routines.
> Drop using port's dn field and use only fwnode - update
> all dependent drivers.
> Because support for more generic fwnode is added,
> replace '_of' suffix with '_fw' in related routines.
> No functional change is introduced by this patch.

It's a bit too narrow text in the commit message, can you use more width?

...

> - ret = of_get_phy_mode(dsa_to_port(ds, 5)->dn, &interface);
> + ret = of_get_phy_mode(to_of_node(dsa_to_port(ds, 5)->fwnode), &interface);

So, I believe this is expected to be a temporary change and something like
fwnode_get_phy_mode() is on its way, correct?

...

> - phy_handle = of_parse_phandle(dp->dn, "phy-handle", 0);
> + phy_handle = of_parse_phandle(to_of_node(dp->fwnode), "phy-handle", 0);

This can be translated to fwnode_find_reference(), but it might require more
changes.

Actually you may start from converting drivers one-by-one to fwnode
APIs (as much as it's possible), and then do with a library call. Up to you.

--
With Best Regards,
Andy Shevchenko