Skip to contentSkip to conversation

kernel.bbclass: run checkpatch.pl for all patches

RFC PATCH In review Mikko Rapeli 2 participants 3 messages Apr 17, 2020

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 kernel.bbclass: run checkpatch.pl for all patches

RFC: currently unconditionally, but this may need to be changed because so many patches are not passing this check. Even upstream backports from Linus Torvalds are failing the check sometimes.

This is test is important to keep all kernel patches in upstreamable state. It would help keeping BSP and project specific kernel recipes in better shape. It will not help if BSP git trees contain 1000's of non-upstreamed patches. Passing this script is mandatory for patches according to
https://www.kernel.org/doc/html/latest/process/submit-checklist.html

checkpatch.pl catches for example:

* missing Signed-off-by lines
* spaces vs. tabs indents, new line issues etc coding style issues
* some bugs like useless initialization of global variables

---
 meta/classes/kernel.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/classes/kernel.bbclass +9 -0
index a724645466..b0c0359d38 100644
@@ -547,6 +547,15 @@ do_savedefconfig() {
 do_savedefconfig[nostamp] = "1"
 addtask savedefconfig after do_configure
 
+do_checkpatch() {
+	bbplain "Running checkpatch.pl QA check for all kernel patches"
+	if ls "${S}"/patches/*.patch > /dev/null; then
+		"${S}/scripts/checkpatch.pl" "${S}"/patches/*.patch
+	fi
+}
+do_checkpatch[nostamp] = "1"
+addtask checkpatch after do_configure
+
 inherit cml1
 
 KCONFIG_CONFIG_COMMAND_append = " HOSTLDFLAGS='${BUILD_LDFLAGS}'"
Signature · 1 line
2.23.0
#1 lore raw
Quoted 9 lines · Mikko Rapeli

RFC: currently unconditionally, but this may need to be changed because so many patches are not passing this check. Even upstream backports from Linus Torvalds are failing the check sometimes.

This is test is important to keep all kernel patches in upstreamable state. It would help keeping BSP and project specific kernel recipes in better shape. It will not help if BSP git trees contain 1000's of non-upstreamed patches. Passing this script is mandatory for patches according to
https://www.kernel.org/doc/html/latest/process/submit-checklist.html

I am not opposed to having more checks, I worry about the impact on build.

Maybe have this in a separate class so folks can opt-in or out depending on final conclusion of this RFC.

- armin

Quoted 34 lines

checkpatch.pl catches for example:

* missing Signed-off-by lines
* spaces vs. tabs indents, new line issues etc coding style issues
* some bugs like useless initialization of global variables

---
 meta/classes/kernel.bbclass | 9 +++++++++
 1 file changed, 9 insertions(+)
meta/classes/kernel.bbclass +9 -0
index a724645466..b0c0359d38 100644
@@ -547,6 +547,15 @@ do_savedefconfig() {
 do_savedefconfig[nostamp] = "1"
 addtask savedefconfig after do_configure
 
+do_checkpatch() {
+	bbplain "Running checkpatch.pl QA check for all kernel patches"
+	if ls "${S}"/patches/*.patch > /dev/null; then
+		"${S}/scripts/checkpatch.pl" "${S}"/patches/*.patch
+	fi
+}
+do_checkpatch[nostamp] = "1"
+addtask checkpatch after do_configure
+
 inherit cml1
 
 KCONFIG_CONFIG_COMMAND_append = " HOSTLDFLAGS='${BUILD_LDFLAGS}'"
#2 lore raw
Quoted 13 lines · On Fri, Apr 17, 2020 at 09:02:30AM -0700, akuster808 wrote:
Quoted 9 lines · Mikko Rapeli

RFC: currently unconditionally, but this may need to be changed because so many patches are not passing this check. Even upstream backports from Linus Torvalds are failing the check sometimes.

This is test is important to keep all kernel patches in upstreamable state. It would help keeping BSP and project specific kernel recipes in better shape. It will not help if BSP git trees contain 1000's of non-upstreamed patches. Passing this script is mandatory for patches according to
https://www.kernel.org/doc/html/latest/process/submit-checklist.html

Quoted 4 lines

I am not opposed to having more checks, I worry about the impact on build.

Maybe have this in a separate class so folks can opt-in or out depending on final conclusion of this RFC.

Agreed. In theory this would belong to insane.bbclass, or would only be added if some extra variable or similar is set in the recipes using kernel.bbclass, or a separate class if you will. I would need some pointers here.

I'm also playing with sparse so that I can easily do sparse checker builds of kernels from different BSPs. Will hopefully use similar approach with that too...

-Mikko