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

From: Marcin Wojtas
Date: Fri Jul 15 2022 - 15:36:35 EST


pt., 15 lip 2022 o 21:25 Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> napisał(a):
>
> 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?
>

Ok.

> ...
>
> > - 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?
>

I use fwnode_get_phy_mode even if this patch. I can do the conversion
here in v3.

> ...
>
> > - 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.

Yes.

>
> 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.
>

I'm dropping the dn and will try to keep the diff in the other drivers
minimal (however, for 2 above cases I will consider of_ -> fwnode_
replacements). Except for mv88e6xxx, I can do only compile-check.

Best regards,
Marcin