Add more checkpatch exceptions to conform to existing depthcharge style
This patch adds the following --ignore tags to checkpatch for
depthcharge, which are necessary to avoid false positives with some
existing (and therefore presumed future) code conventions in
SPACING: Creates errors like "src/arch/arm/fit.c:52: ERROR: need
consistent spacing around '*' (ctx:WxV)" for pointer declarations and
"src/arch/arm/boot.c:47: ERROR: spaces required around that ':'
(ctx:WxO)" with extended asm. I think this may be because checkpatch
expects all types that aren't in a predefined list to either start with
'struct ' or end in '_t', which is untrue all over depthcharge.
PREFER_PACKED,PREFER_PRINTF,PREFER_ALIGNED: Expects use of the __packed,
__printf and __aligned() macros that wrap __attribute__((packed)), etc.
in the kernel. These macros do not exist in depthcharge (and they
conceal more than they clear up if you ask me).
GLOBAL_INITIALISERS,INITIALISED_STATIC: Forbids variables to be
explicitly initialized to 0 or NULL, which is done in multiple places in
depthcharge. I honestly really don't understand this policy anyway...
explicit initialization doesn't hurt and can often make intentions
clearer (i.e. point out if a variable isn't initialized because we don't
care, or because the code depends on it to start at 0/NULL).
OPEN_BRACE: Forbids starting the open brace for a struct or enum
declaration on a new line, which is done many times in depthcharge.
Since this is often done in headers that will probably serve as
templates for new code in the future, we should ignore it to avoid
confusing people that try to port new drivers.
TRAILING_STATEMENTS: This is just a stupid parser. It is supposed to
flag things like 'if (foo) blah;' on the same line (which we
occasionally use but I'm not too attached to), but it also flags things
like 'if (foo) // this does X' (where the actual code is
correctly on the next line), which we use pretty often. This should
really just be fixed, but I assume that we want to keep a clear copy of
the upstream checkpatch.pl for now so --ignore is our only option.
TEST=Ran checkpatch.pl with these options across the whole source base.
Confirmed that the remaining errors it points out look like actual
problems (e.g. some 80 char limit, some incorrect indentations, some
style inconsistencies), or lie in code parts that have been imported in
bulk without explicit attention to making them style-conformant (e.g.
debug/cli, kconfig, net/uip*, and some recently added IPQ drivers).
Signed-off-by: Julius Werner <firstname.lastname@example.org>
Reviewed-by: David Hendricks <email@example.com>
Reviewed-by: Stefan Reinauer <firstname.lastname@example.org>
1 file changed