mirror of
https://github.com/u-boot/u-boot.git
synced 2025-04-16 01:44:34 +00:00
checkpatch.pl: Make CONFIG_IS_ENABLED(CONFIG_*) an error
CONFIG_IS_ENABLED() takes the kconfig name without the CONFIG_ prefix, e.g. CONFIG_IS_ENABLED(CLK) for CONFIG_CLK. Make including the prefix an error in checkpatch.pl so calls in the wrong format aren't accidentally reintroduced. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
957a3e5493
commit
b9cca2c57a
2 changed files with 12 additions and 0 deletions
|
@ -2365,6 +2365,12 @@ sub u_boot_line {
|
||||||
ERROR("DISABLE_FDT_OR_INITRD_RELOC",
|
ERROR("DISABLE_FDT_OR_INITRD_RELOC",
|
||||||
"fdt or initrd relocation disabled at boot time\n" . $herecurr);
|
"fdt or initrd relocation disabled at boot time\n" . $herecurr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Do not use CONFIG_ prefix in CONFIG_IS_ENABLED() calls
|
||||||
|
if ($line =~ /^\+.*CONFIG_IS_ENABLED\(CONFIG_\w*\).*/) {
|
||||||
|
ERROR("CONFIG_IS_ENABLED_CONFIG",
|
||||||
|
"CONFIG_IS_ENABLED() takes values without the CONFIG_ prefix\n" . $herecurr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub process {
|
sub process {
|
||||||
|
|
|
@ -405,6 +405,12 @@ index 0000000..2234c87
|
||||||
pm.add_line('include/myfile.h', '#include <dm.h>')
|
pm.add_line('include/myfile.h', '#include <dm.h>')
|
||||||
self.checkSingleMessage(pm, 'BARRED_INCLUDE_IN_HDR', 'error')
|
self.checkSingleMessage(pm, 'BARRED_INCLUDE_IN_HDR', 'error')
|
||||||
|
|
||||||
|
def testConfigIsEnabledConfig(self):
|
||||||
|
"""Test for accidental CONFIG_IS_ENABLED(CONFIG_*) calls"""
|
||||||
|
pm = PatchMaker()
|
||||||
|
pm.add_line('common/main.c', 'if (CONFIG_IS_ENABLED(CONFIG_CLK))')
|
||||||
|
self.checkSingleMessage(pm, 'CONFIG_IS_ENABLED_CONFIG', 'error')
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
Loading…
Add table
Reference in a new issue