Re: [PATCH net-next 08/15] net: dsa: sja1105: transition OF-based MDIO drivers to standalone

Vladimir Oltean
2025-11-20T15:15:08Z

Hi Lee,

Thank you for commenting on the patch!

On Thu, Nov 20, 2025 at 02:40:46PM +0000, Lee Jones wrote:
> The MFD API is not to be {ab}used out side of drivers/mfd.

If mfd_add_devices() is not to be used outside of drivers/mfd, why
export it to the global include/linux/mfd/core.h in the first place,
rather than make the header available just to drivers/mfd?

> Maybe of_platform_populate() will scratch your itch instead.

I did already explore of_platform_populate() on this thread which asked
for advice (to which you were also copied):
https://lore.kernel.org/lkml/20221222134844.lbzyx5hz7z5n763n@skbuf/

It looks like of_platform_populate() would be an alternative option for
this task, but that doesn't live up to the task either. It will assume
that the addresses of the SoC children are in the CPU's address space
(IORESOURCE_MEM), and attempt to translate them. It simply doesn't have
the concept of IORESOURCE_REG. The MFD drivers which call
of_platform_populate() (simple-mfd-i2c.c) simply don't have unit
addresses for their children, and this is why address translation isn't
a problem for them.

I'm not trying to start an argument, but as you can see, I've been stuck
on this problem for years, and I'm between a rock and a hard place.