[U-Boot] Question about Coding-Style

Michael Trimarchi michael at amarulasolutions.com
Tue Feb 4 15:18:29 CET 2014


Hi

Il 04/feb/2014 15:15 "Stefano Babic" <sbabic at denx.de> ha scritto:
>
> Hi Hannes,
>
> On 04/02/2014 13:50, Hannes Petermaier wrote:
> > Hello,
> >
> > I've read on the U-Boot website about coding style. They say 'All
> > contributions to U-Boot should conform to the Linux kernel coding
style'.
> > Further i've read this link and there are at least 2 things which i have
> > troubles with.
> >
> > 1)
> > a tab-ident is 8 spaces
>
> Right
>
> > (in eclipse for example with the built in K&R has
> > 4 characters). With 8 characters per TAB the problem from point 2 enters
> > very, very fast.

If it happens your code has two many nested block

Michael

> >
> > 2)
> > a line ist limited to 80 characters (maybe thus comes from very old days
> > where displays couldn't show more than this and scrolling was very
> > expensive). is this state of the art ?
>
> Yes, it is. Same rule as in kernel.
>
> >
> > In fact i've found a lot of files within the u-boot code which do not
obey
> > to this rules.
>
> I cannot tell for each exceptions you found. Maybe the code is very old,
> and it slipped into mainline without fixing the lenght. There are also
> some well-known exception (generally for tables), where a longer line
> was accepted after discussion in the ML to increase readability.
> (tables for pinmux, as example
arch/arm/include/asm/arch-mx6/mx6dl_pins.h).
>
> >
> > Now my question is, how strong are this two points ?
>
> They are strong until there is a general acceptance on the ML to drop
> the rule. However, the rule was already discussed in the past (you can
> dig deep in archives), and the result was to maintain it, exactly as it
> is valid for linux.
>
>
> > checkpatch.pl rails against a patch file with a lot of warnings if there
> > is a line longer than 80bytes, also it takes TABS as 8 spaces.
>
> checkpatch is run before merging a patch into a merge tree by
> custodians. If checkpatch reports errors, they must be fixed.
>
> >
> > whats your opinion about this ?
> >
> > Last question:
> > Is this mailing list the right place of discussing such things ?
> >
>
> I think you are in the right place to discuss these topics ;-)
>
> Best regards,
> Stefano Babic
>
> --
> =====================================================================
> DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
> =====================================================================
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list