Re: [PATCH] of: make for_each_property_of_node() available to to !OF
From: Bartosz Golaszewski
Date: Tue Mar 05 2024 - 13:46:17 EST
On Tue, 5 Mar 2024 18:56:04 +0100, Rob Herring <robh+dt@xxxxxxxxxx> said:
>
> Long term, I want to make struct device_node opaque. So if we really
> want to fix this, I think we'd want to convert this to use an iterator
> function. Though I guess any user would be mucking with struct
> property too, so the whole loop would need to be reworked. So in
> conclusion, don't use for_each_property_of_node(). :) Shrug.
>
I basically just need to get the list of all properties of a node. Even just
names. I'm working on a testing driver that needs to request all GPIOs assigned
to it over DT so it must find all `foo-gpios` properties.
How about:
int of_node_for_each_property(struct device_node *dn, int
(*func)(struct property *, void *), void *data)
as the iterator? You didn't say if you want to make struct property opaque as
well but even then it can be used with provided interfaces.
Bart