X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=scripts%2Fcheckpatch.pl;h=edba36565167b38bffbe2e1f0a09df60b7deb3e9;hb=a0092cf236907e8ced652c9ef1fc5bfa7e6fdee7;hp=b8b057ce56e66290fdadea999dc0c2d81bb0491c;hpb=b77df5980c3e24e34e0db3a52c5bce396a81c430;p=oweals%2Fu-boot.git diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index b8b057ce56..edba365651 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -2243,6 +2243,36 @@ sub pos_last_openparen { # Checks specific to U-Boot sub u_boot_line { my ($realfile, $line, $herecurr) = @_; + + # ask for a test if a new uclass ID is added + if ($realfile =~ /uclass-id.h/ && $line =~ /^\+/) { + WARN("NEW_UCLASS", + "Possible new uclass - make sure to add a sandbox driver, plus a test in test/dm/.c\n" . $herecurr); + } + + # try to get people to use the livetree API + if ($line =~ /^\+.*fdtdec_/) { + WARN("LIVETREE", + "Use the livetree API (dev_read_...)\n" . $herecurr); + } + + # add tests for new commands + if ($line =~ /^\+.*do_($Ident)\(struct cmd_tbl.*/) { + WARN("CMD_TEST", + "Possible new command - make sure you add a test\n" . $herecurr); + } + + # use if instead of #if + if ($line =~ /^\+#if.*CONFIG.*/) { + WARN("PREFER_IF", + "Use 'if (IS_ENABLED(CONFIG...))' instead of '#if or #ifdef' where possible\n" . $herecurr); + } + + # use defconfig to manage CONFIG_CMD options + if ($line =~ /\+\s*#\s*(define|undef)\s+(CONFIG_CMD\w*)\b/) { + ERROR("DEFINE_CONFIG_CMD", + "All commands are managed by Kconfig\n" . $herecurr); + } } sub process {