[RFC 1/7] dm: add get_dp_node() to struct uclass_driver
Heinrich Schuchardt
heinrich.schuchardt at canonical.com
Mon Mar 27 11:41:33 CEST 2023
On 3/27/23 10:24, Simon Glass wrote:
> 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
If you have multiple listeners for a single event, you can't be sure who
added what.
>
>>
>> event_notfify() does not allow to select a single recipient.
>
> Do you need that? You can check whether the uclass matches, for example.
Checking the uclass multiple times is not efficient.
We are talking about 1 KiB for the pointers vs repetitive coding. We
should go for the simplest code and most efficient code.
If you want to save memory, (temporarily) remove unused methods in
struct uclass_driver: pre_unbind, post_bind, post_remove.
Best regards
Heinrich
>
>>
>> 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