Re: Implementation of fwnode_operations :: device_get_match_data() for software nodes?

From: Andy Shevchenko
Date: Mon Mar 25 2024 - 12:01:42 EST


+Cc: people who might be also interested in this topic.

On Wed, Mar 01, 2023 at 07:43:09PM +0200, Vladimir Oltean wrote:
> On Wed, Mar 01, 2023 at 07:33:29PM +0200, Andy Shevchenko wrote:

Sorry for really late reply. I somehow forgot to answer.

> > Yes, that's why I remember overlays approach and FPGA case.
> >
> > I guess you have very similar requirements to get this done: your case is a
> > particular one for FPGA, i.e. (re-)loading the same HW layout over and over.
> >
> > I believe it should be discussed with them being involved. We don't want to
> > have two approaches of similar things in the kernel.
>
> I don't think comparisons with the denatured case are helpful.
> Is "ax + b = 0" a quadratic equation? Well, yes, if you consider it to
> be a particular case where the coefficient of x^2 is 0. Do you use
> quadratic equation techniques to solve it? No.
>
> I agree we don't want to have multiple approaches of doing the same thing,
> but I debate whether I am really doing the same thing?
>
> If software nodes are not designed to be a good fit for my kind of use
> case, then what are they designed for?

I think the hardware should be described in the respective format. Yet, you
have a point that it's too verbose to the cases when we know the layout of
the attached (not-hotpluggable) devices.

There are discussions [1,2] on how to enable DT for the cases when
non-discoverable HW needs to be detected and enumerated.

I don't know which solution will eventually be accepted, but my personal
opinion here that we would like to distantiate from board files as much
as possible.

Btw, for the internal (board files) code we may also use property to
go with (see how spi-pxa2xx uses that) to distinguish configurations.
But it might be not that straight as with driver data.

So far, I haven't seen the code (am I mistaken?) which makes use of driver data
for software nodes.

[1]: https://lore.kernel.org/lkml/20231128084236.157152-1-wenst@xxxxxxxxxxxx/
[2]: https://lore.kernel.org/lkml/1692120000-46900-1-git-send-email-lizhi.hou@xxxxxxx/

Aux topics which might not directly be related (in order of declining relevance
from my p.o.v.):
https://lore.kernel.org/lkml/20231130165700.685764-1-herve.codina@xxxxxxxxxxx/
https://lore.kernel.org/lkml/DM6PR12MB3993D5ECA50B27682AEBE19FCD67A@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/
https://lore.kernel.org/lkml/20240217010557.2381548-1-sboyd@xxxxxxxxxx/

--
With Best Regards,
Andy Shevchenko