Skip to contentSkip to conversation

checkpatch: Do appropriate kernel->qemu renaming

PATCH Applied Aleksandar Markovic 5 participants 12 messages Jun 20, 2020 – Jul 1, 2020 Checkpatch

lore
Share & tools
lore
#0 lore raw

cover checkpatch: Do appropriate kernel->qemu renaming

There are several places where 'kernel' is mentioned instead of 'qemu' in checkpatch.pl.

This small series corrects this.

Aleksandar Markovic (2):
checkpatch: Rename top_of_kernel_tree() to top_of_qemu_tree()
checkpatch: Change occurences of 'kernel' to 'qemu' in user messages

 scripts/checkpatch.pl | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/2 checkpatch: Rename top_of_kernel_tree() to top_of_qemu_tree()

This subroutine establishes top of qemu, not kernel, tree.

Do appropriate renaming.

---
 scripts/checkpatch.pl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/checkpatch.pl +4 -4
index 0ba213e9f2..c760c5a4a9 100755
@@ -190,14 +190,14 @@ if ($terse) {
 
 if ($tree) {
 	if (defined $root) {
-		if (!top_of_kernel_tree($root)) {
+		if (!top_of_qemu_tree($root)) {
 			die "$P: $root: --root does not point at a valid tree\n";
 		}
 	} else {
-		if (top_of_kernel_tree('.')) {
+		if (top_of_qemu_tree('.')) {
 			$root = '.';
 		} elsif ($0 =~ m@(.*)/scripts/[^/]*$@ &&
-						top_of_kernel_tree($1)) {
+						top_of_qemu_tree($1)) {
 			$root = $1;
 		}
 	}
@@ -456,7 +456,7 @@ if ($chk_branch) {
 
 exit($exit);
 
-sub top_of_kernel_tree {
+sub top_of_qemu_tree {
 	my ($root) = @_;
 
 	my @tree_check = (
Signature · 1 line
2.20.1
#2 lore raw

PATCH 2/2 checkpatch: Change occurences of 'kernel' to 'qemu' in user messages

In reply to Aleksandar Markovic

It is odd that we inform user that, for example, his current working directory is not kernel root, when, in face, we mean qemu root.

Replace that and few other similar odd user messages.

---
 scripts/checkpatch.pl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +3 -3
index c760c5a4a9..f46c18e413 100755
@@ -49,7 +49,7 @@ Version: $V
 
 Options:
   -q, --quiet                quiet
-  --no-tree                  run without a kernel tree
+  --no-tree                  run without a qemu tree
   --no-signoff               do not check for 'Signed-off-by' line
   --patch                    treat FILE as patchfile
   --branch                   treat args as GIT revision list
@@ -57,7 +57,7 @@ Options:
   --terse                    one line per report
   -f, --file                 treat FILE as regular source file
   --strict                   fail if only warnings are found
-  --root=PATH                PATH to the kernel tree root
+  --root=PATH                PATH to the qemu tree root
   --no-summary               suppress the per-file summary
   --mailback                 only produce a report in case of warnings/errors
   --summary-file             include the filename in summary
@@ -203,7 +203,7 @@ if ($tree) {
 	}
 
 	if (!defined $root) {
-		print "Must be run from the top-level dir. of a kernel tree\n";
+		print "Must be run from the top-level dir. of a qemu tree\n";
 		exit(2);
 	}
 }
Signature · 1 line
2.20.1
Reviewed-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] checkpatch: Change occurences of 'kernel' to 'qemu' in user messages

Quoted 10 lines · Aleksandar Markovic

It is odd that we inform user that, for example, his current working directory is not kernel root, when, in face, we mean qemu root.

Replace that and few other similar odd user messages.

---
 scripts/checkpatch.pl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Regardless of my comments on the cover letter, for user facing messages this makes sense, especially since it's only 3 lines.

thanks
-- PMM

#4 lore raw

Re: [PATCH 2/2] checkpatch: Change occurences of 'kernel' to 'qemu' in user messages

Quoted 13 lines · Peter Maydell
Quoted 10 lines · Aleksandar Markovic

It is odd that we inform user that, for example, his current working directory is not kernel root, when, in face, we mean qemu root.

Replace that and few other similar odd user messages.

---
 scripts/checkpatch.pl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Quoted 8 lines

Regardless of my comments on the cover letter, for user facing messages this makes sense, especially since it's only 3 lines.

thanks
-- PMM

Queued, thanks.

paolo

#5 lore raw

Re: [PATCH 2/2] checkpatch: Change occurences of 'kernel' to 'qemu' in user messages

Quoted 18 lines · Paolo Bonzini
Quoted 16 lines · Peter Maydell
Quoted 10 lines · Aleksandar Markovic

It is odd that we inform user that, for example, his current working directory is not kernel root, when, in face, we mean qemu root.

Replace that and few other similar odd user messages.

---
 scripts/checkpatch.pl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Regardless of my comments on the cover letter, for user facing messages this makes sense, especially since it's only 3 lines.

Quoted 8 lines
Quoted 5 lines

thanks
-- PMM

Queued, thanks.

Thanks a lot, Paolo.

There is though one spelling mistake in my commit message:

s/face/fact

Truly yours,
Aleksandar

Quoted 2 lines

paolo

#6 lore raw

Re: [PATCH 2/2] checkpatch: Change occurences of 'kernel' to 'qemu' in user messages

In reply to Aleksandar Markovic
Quoted 8 lines · Aleksandar Markovic

It is odd that we inform user that, for example, his current working directory is not kernel root, when, in face, we mean qemu root.

Replace that and few other similar odd user messages.

---

Paolo, Stefan, Michael,

Are some of you willing to select this patch for your queues?

I could include it in my mips queue, scheduled to be sent soon, but I certainly don't want to be seen intruding into someone else's area.

Truly yours, Aleksandar

Quoted 37 lines
 scripts/checkpatch.pl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/checkpatch.pl +3 -4
index c760c5a4a9..f46c18e413 100755
@@ -49,7 +49,7 @@ Version: $V
 
 Options:
   -q, --quiet                quiet
-  --no-tree                  run without a kernel tree
+  --no-tree                  run without a qemu tree
   --no-signoff               do not check for 'Signed-off-by' line
   --patch                    treat FILE as patchfile
   --branch                   treat args as GIT revision list
@@ -57,7 +57,7 @@ Options:
   --terse                    one line per report
   -f, --file                 treat FILE as regular source file
   --strict                   fail if only warnings are found
-  --root=PATH                PATH to the kernel tree root
+  --root=PATH                PATH to the qemu tree root
   --no-summary               suppress the per-file summary
   --mailback                 only produce a report in case of warnings/errors
   --summary-file             include the filename in summary
@@ -203,7 +203,7 @@ if ($tree) {
        }
 
        if (!defined $root) {
-               print "Must be run from the top-level dir. of a kernel tree\n";
+               print "Must be run from the top-level dir. of a qemu tree\n";
                exit(2);
        }
 }
--

2.20.1

#7 lore raw
In reply to Aleksandar Markovic
Quoted 4 lines · Aleksandar Markovic

There are several places where 'kernel' is mentioned instead of 'qemu' in checkpatch.pl.

This small series corrects this.

So, the thing about this kind of change is that it's implicitly saying "we have forked checkpatch and will not try to update to newer versions of it from the kernel tree", because this sort of no-behavioural-change tends to get in the way of that kind of update by obscuring the delta between the kernel version and ours. Effectively I think we *have* ended up with our own fork,
simply because we haven't cared to do that kind of update from the kernel's version and we've gradually added our own changes to our copy. But it seems like it's worth discussing the general principle.

thanks
-- PMM

#8 lore raw

суб, 20. јун 2020. у 16:25 Peter Maydell <[email protected]> је написао/ла:

Quoted 8 lines
Quoted 4 lines · Aleksandar Markovic

There are several places where 'kernel' is mentioned instead of 'qemu' in checkpatch.pl.

This small series corrects this.

Quoted 10 lines

So, the thing about this kind of change is that it's implicitly saying "we have forked checkpatch and will not try to update to newer versions of it from the kernel tree", because this sort of no-behavioural-change tends to get in the way of that kind of update by obscuring the delta between the kernel version and ours. Effectively I think we *have* ended up with our own fork,
simply because we haven't cared to do that kind of update from the kernel's version and we've gradually added our own changes to our copy. But it seems like it's worth discussing the general principle.

I do not say (explicitly or implicitly) that we should or should not follow and attempt to mirror changes in checkpatch.pl from kernel. (In fact, I think we should.)

However, I don't think that several differences (in this series, I thinks altogether 7 lines) that would originate from difference of names QEMU vs. kernel would not be any significant obstacle for a potential future attempts to do comparison QEMU checkpatch vs kernel chekpatch.

Take a look at two versions of top_of_kernel_tree below - they already differ in their body. Left this way, QEMU's checkpatch version simply violates basic naming principles in software development. And, it looks we want to sacrifice the principle - just for the sake of convenience of a potential engineer having 7 less line in his diff (out of much more).

I don't insist on these two patches. I, of course, leave the decision to Peter, Paolo, Stefan, Michael, or others tracking kernel's checkpatch script.

Thanks,
Aleksandar

QEMU version:

sub top_of_kernel_tree {
my ($root) = @_;

my @tree_check = (
"COPYING", "MAINTAINERS", "Makefile",
"README.rst", "docs", "VERSION",
"linux-user", "softmmu"
);

foreach my $check (@tree_check) {
if (! -e $root . '/' . $check) {
return 0;
}
}
return 1;
}

Kernel version:

sub top_of_kernel_tree {
my ($root) = @_;

my @tree_check = (
"COPYING", "CREDITS", "Kbuild", "MAINTAINERS", "Makefile", "README", "Documentation", "arch", "include", "drivers", "fs", "init", "ipc", "kernel", "lib", "scripts", );

foreach my $check (@tree_check) {
if (! -e $root . '/' . $check) {
return 0;
}
}
return 1;
}

Quoted 2 lines

thanks
-- PMM

#9 lore raw

суб, 20. јун 2020. у 17:09 Aleksandar Markovic
<[email protected]> је написао/ла:

Quoted 26 lines

суб, 20. јун 2020. у 16:25 Peter Maydell <[email protected]> је написао/ла:

Quoted 8 lines
Quoted 4 lines · Aleksandar Markovic

There are several places where 'kernel' is mentioned instead of 'qemu' in checkpatch.pl.

This small series corrects this.

Quoted 10 lines

So, the thing about this kind of change is that it's implicitly saying "we have forked checkpatch and will not try to update to newer versions of it from the kernel tree", because this sort of no-behavioural-change tends to get in the way of that kind of update by obscuring the delta between the kernel version and ours. Effectively I think we *have* ended up with our own fork,
simply because we haven't cared to do that kind of update from the kernel's version and we've gradually added our own changes to our copy. But it seems like it's worth discussing the general principle.

I do not say (explicitly or implicitly) that we should or should not follow and attempt to mirror changes in checkpatch.pl from kernel. (In fact, I think we should.)

Quoted 6 lines

However, I don't think that several differences (in this series, I thinks altogether 7 lines) that would originate from difference of names QEMU vs. kernel would not be any significant obstacle for a potential future attempts to do comparison QEMU checkpatch vs kernel chekpatch.

Sorry, I meant to say:

However, I don't think that several differences (in this series, I think, altogether 7 lines) that would originate from difference of names (QEMU vs. kernel) would be any significant obstacle for a potential future attempts to do comparison QEMU checkpatch vs kernel checkpatch.

Quoted 54 lines

Take a look at two versions of top_of_kernel_tree below - they already differ in their body. Left this way, QEMU's checkpatch version simply violates basic naming principles in software development. And, it looks we want to sacrifice the principle - just for the sake of convenience of a potential engineer having 7 less line in his diff (out of much more).

I don't insist on these two patches. I, of course, leave the decision to Peter, Paolo, Stefan, Michael, or others tracking kernel's checkpatch script.

Thanks,
Aleksandar

QEMU version:

sub top_of_kernel_tree {
my ($root) = @_;

my @tree_check = (
"COPYING", "MAINTAINERS", "Makefile",
"README.rst", "docs", "VERSION",
"linux-user", "softmmu"
);

foreach my $check (@tree_check) {
if (! -e $root . '/' . $check) {
return 0;
}
}
return 1;
}

Kernel version:

sub top_of_kernel_tree {
my ($root) = @_;

my @tree_check = (
"COPYING", "CREDITS", "Kbuild", "MAINTAINERS", "Makefile", "README", "Documentation", "arch", "include", "drivers", "fs", "init", "ipc", "kernel", "lib", "scripts", );

foreach my $check (@tree_check) {
if (! -e $root . '/' . $check) {
return 0;
}
}
return 1;
}

Quoted 2 lines

thanks
-- PMM

#10 lore raw
Quoted 35 lines · Aleksandar Markovic

суб, 20. јун 2020. у 17:09 Aleksandar Markovic
<[email protected]> је написао/ла:

Quoted 26 lines

суб, 20. јун 2020. у 16:25 Peter Maydell <[email protected]> је написао/ла:

Quoted 8 lines
Quoted 4 lines · Aleksandar Markovic

There are several places where 'kernel' is mentioned instead of 'qemu' in checkpatch.pl.

This small series corrects this.

Quoted 10 lines

So, the thing about this kind of change is that it's implicitly saying "we have forked checkpatch and will not try to update to newer versions of it from the kernel tree", because this sort of no-behavioural-change tends to get in the way of that kind of update by obscuring the delta between the kernel version and ours. Effectively I think we *have* ended up with our own fork,
simply because we haven't cared to do that kind of update from the kernel's version and we've gradually added our own changes to our copy. But it seems like it's worth discussing the general principle.

I do not say (explicitly or implicitly) that we should or should not follow and attempt to mirror changes in checkpatch.pl from kernel. (In fact, I think we should.)

Quoted 6 lines

However, I don't think that several differences (in this series, I thinks altogether 7 lines) that would originate from difference of names QEMU vs. kernel would not be any significant obstacle for a potential future attempts to do comparison QEMU checkpatch vs kernel chekpatch.

Quoted 7 lines

Sorry, I meant to say:

However, I don't think that several differences (in this series, I think, altogether 7 lines) that would originate from difference of names (QEMU vs. kernel) would be any significant obstacle for a potential future attempts to do comparison QEMU checkpatch vs kernel checkpatch.

I looked through the 2020, 2019, and 2018 git log for checkpatch.pl and found few commits that were directly applied from Linux. Some were rewritten from scratch for QEMU and inspired by Linux commits. In practice QEMU maintains a fork rather than a mirror of checkpatch.pl.

Let's encourage improvements to checkpatch.pl, even if that means diverging further from Linux, because it's a valuable tool for improving coding style, quality, etc. If there is a feeling that changes to checkpatch.pl are discouraged there will be more coding style inconsistencies, reviewers will have to point out trivial issues manually, etc because we're afraid to touch the script.

Stefan

Acked-by on the v1 series
#11 lore raw
In reply to Aleksandar Markovic
Quoted 4 lines · Aleksandar Markovic

There are several places where 'kernel' is mentioned instead of 'qemu' in checkpatch.pl.

This small series corrects this.

fine by me

Quoted 9 lines

Aleksandar Markovic (2):
checkpatch: Rename top_of_kernel_tree() to top_of_qemu_tree()
checkpatch: Change occurences of 'kernel' to 'qemu' in user messages

 scripts/checkpatch.pl | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
Signature · 1 line
2.20.1