[PATCH v1 02/43] binman: Refactor binman_entry_find() to allow other nodes

Tom Rini trini at konsulko.com
Wed Jul 8 16:40:16 CEST 2020


On Wed, Jul 08, 2020 at 12:07:24PM +0800, Bin Meng wrote:
> +Tom,
> 
> On Wed, Jul 8, 2020 at 10:23 AM Simon Glass <sjg at chromium.org> wrote:
> >
> > Hi Bin,
> >
> > On Mon, 29 Jun 2020 at 20:33, Bin Meng <bmeng.cn at gmail.com> wrote:
> > >
> > > Hi Simon,
> > >
> > > On Mon, Jun 15, 2020 at 11:57 AM Simon Glass <sjg at chromium.org> wrote:
> > > >
> > > > At present we can only read from a top-level binman node entry. Refactor
> > > > this function to produce a second local function which supports reading
> > > > from any node.
> > > >
> > > > Signed-off-by: Simon Glass <sjg at chromium.org>
> > > > ---
> > > >
> > > >  lib/binman.c | 18 ++++++++++++------
> > > >  1 file changed, 12 insertions(+), 6 deletions(-)
> > > >
> > > > diff --git a/lib/binman.c b/lib/binman.c
> > > > index dc3a880882..79d01230dd 100644
> > > > --- a/lib/binman.c
> > > > +++ b/lib/binman.c
> > > > @@ -29,25 +29,31 @@ struct binman_info {
> > > >
> > > >  static struct binman_info *binman;
> > > >
> > > > -int binman_entry_find(const char *name, struct binman_entry *entry)
> > > > +int binman_entry_find_(ofnode node, const char *name, struct binman_entry *entry)
> > >
> > > This one should be static. We really should agree on a naming
> > > convention for such internal APIs. I would prefer adding _internal
> > > suffix, or using __ prefix
> >
> > Well I think internal is too long and I like a trailing underscore.
> >
> 
> The trailing underscore is easy to be misread.
> 
> > The trailing double underscore is reserved for the compiler.
> >
> 
> What I prefer is the leading double underscore which I think is allowed.
> 
> > Another option is to drop the prefix, so:
> >
> > find_entry(...)

I don't like using _ as a suffix.  Double leading underscore is what we
use elsewhere, so I think that's my preference as well.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200708/9efb83f3/attachment.sig>


More information about the U-Boot mailing list