[U-Boot] [PATCH 08/22] dm: core: Add dev_get_uclass_priv() to access uclass private data
Simon Glass
sjg at chromium.org
Thu Mar 5 05:10:08 CET 2015
Hi Bin,
On 26 February 2015 at 00:26, Bin Meng <bmeng.cn at gmail.com> wrote:
> Hi Simon,
>
> On Thu, Feb 19, 2015 at 5:10 AM, Simon Glass <sjg at chromium.org> wrote:
>> Add a convenience function to access the private data that a uclass stores
>> for each of its devices. Convert over most existing uses for consistency
>> and to provide an example for others.
>
> What's the benefit of doing this? It (dev_get_uclass_priv) looks
> verbose to me. And you cannot stop people from doing that
> (dev->uclass_priv) either.
>
The idea is that we can check that the device is valid, and it has a
valid uclass, that the private data is there, etc. We don't have many
checks like this at present but this makes it possible to add them.
With all the pointers flying around I would really like to add some
checking, perhaps CONFIG_DM_CHECK, which checks these pointers.
Regards,
Simon
More information about the U-Boot
mailing list