[U-Boot] [PATCH 6/8] dm: core: look up drivers more efficiently
Simon Glass
sjg at chromium.org
Mon Nov 17 19:25:10 CET 2014
Hi Masahiro,
On 17 November 2014 11:49, Masahiro Yamada <yamada.m at jp.panasonic.com> wrote:
> Hi Simon,
>
>
> On Mon, 17 Nov 2014 09:22:19 +0000
> Simon Glass <sjg at chromium.org> wrote:
>> > --- a/drivers/core/device.c
>> > +++ b/drivers/core/device.c
>> > @@ -157,11 +157,9 @@ int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
>> > {
>> > struct driver *drv;
>> >
>> > - drv = lists_driver_lookup_name(info->name);
>> > + drv = __lists_driver_lookup_name(info->name, pre_reloc_only);
>>
>> This patch looks good, except that I would prefer
>> lists_driver_lookup_name_prereloc() to __lists_driver_lookup_name().
>> The __ seems like an internal compiler name to me. So can you rename
>> it?
>
> Indeed. I think __ should be used carefully especially when it comes to
> host programs, but I think we can play it by ear in standalone binaries
> such as the kernel and U-boot code.
>
> I often see "__" prefixes in Linux and in my understanding,
> __foo() is a "use it carefully" version or locally used interface of foo()
> (for example, when the resources are not protected by spinlocks, etc.).
> So, I often use it when I cannot invent a good func name.
>
> Hmm, lists_driver_lookup_name_prereloc() is already too long
> and __prereloc is a bit misleading because it is used both before and after relocation,
> isn't it?
OK that seems fair enough if used sparingly. I can't think of a great
name either and we don't really want to pollute the code with the
pre_reloc_only parameter since it will be used in many places.
Acked-by: Simon Glass <sjg at chromium.org>
Regards,
Simon
More information about the U-Boot
mailing list