[RFC 1/7] dm: add get_dp_node() to struct uclass_driver

Simon Glass sjg at chromium.org
Mon Mar 27 10:24:09 CEST 2023


Hi Heinrich,

On Mon, 27 Mar 2023 at 19:48, Heinrich Schuchardt
<heinrich.schuchardt at canonical.com> wrote:
>
>
>
> On 3/27/23 06:00, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Mon, 27 Mar 2023 at 06:27, Heinrich Schuchardt
> > <heinrich.schuchardt at canonical.com> wrote:
> >>
> >> Currently the device paths don't match the dm tree.
> >> We should create a device path node per dm tree node.
> >>
> >> Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> >> ---
> >>   include/dm/uclass.h | 5 +++++
> >>   1 file changed, 5 insertions(+)
> >
> > This affects very few uclasses but adds a field to all of them. I
> > think an event might be best for this. We can add an event spy in each
> > of the affected uclasses.
>
> EVENT_SPY does not allow to return information to the emitter of the event.

You just add it into unio event_data

>
> event_notfify() does not allow to select a single recipient.

Do you need that? You can check whether the uclass matches, for example.

>
> In struct uclass_driver there are many other fields that are rarely used:
>
>          int (*post_bind)(struct udevice *dev);
>          int (*pre_unbind)(struct udevice *dev);
>          int (*pre_probe)(struct udevice *dev);
>          int (*post_probe)(struct udevice *dev);
>          int (*pre_remove)(struct udevice *dev);
>          int (*child_post_bind)(struct udevice *dev);
>          int (*child_pre_probe)(struct udevice *dev);
>          int (*child_post_probe)(struct udevice *dev);
>
> If we wanted to save memory in linker generated lists we would convert
> structures with pointers to variable size arrays e.g.
>
> struct ops * =
> {
> { POST_BIND, post_bind },
> { CHILD_POST_BIND, child_post_bind},
> { END, NULL },
> }
>

Yes. We have the same problem with devices. We have a way to resolve
this today, using tags. We use DM_TAG_EFI and there are tags for the
devices but support for using them to reduce the struct sizes is not
yet added.

We might have a problem with efficiency, since direct pointers are
faster, but of course we can address that using a suitable data
structure.

Regards,
Simon


More information about the U-Boot mailing list