Skip to contentSkip to conversation

checkpatch-dont-emit-the-camelcase-warning-for-pagefoo.patch removed from -mm tree

merged In review [email protected] 4 participants 10 messages Feb 22, 2013 Checkpatch

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: checkpatch: don't emit the CamelCase warning for PageFoo
has been removed from the -mm tree. Its filename was
checkpatch-dont-emit-the-camelcase-warning-for-pagefoo.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Joe Perches <[email protected]>
Subject: checkpatch: don't emit the CamelCase warning for PageFoo

I'm getting a ton of these:

WARNING: Avoid CamelCase: <PageTransHuge>
#140: FILE: mm/migrate.c:1576:
+ if (PageTransHuge(page) && page_count(page) != 3) {

So exclude anything which starts with "Page".

---

 scripts/checkpatch.pl |    1 +
 1 file changed, 1 insertion(+)
scripts/checkpatch.pl renamed from scripts/checkpatch.pl~checkpatch-dont-emit-the-camelcase-warning-for-pagefoo +1 -0
diff -puN scripts/checkpatch.pl~checkpatch-dont-emit-the-camelcase-warning-for-pagefoo scripts/checkpatch.pl
@@ -2930,6 +2930,7 @@ sub process {
 			my $var = $1;
 			if ($var !~ /$Constant/ &&
 			    $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ &&
+			    $var !~ /^Page[A-Z]/ &&
 			    !defined $camelcase{$var}) {
 				$camelcase{$var} = 1;
 				WARN("CAMELCASE",

_

Patches currently in -mm which might be from [email protected] are

origin.patch
linux-next.patch get_maintainer-allow-keywords-to-match-filenames.patch fs-proc-clean-up-printks.patch fs-proc-clean-up-printks-fix.patch fs-proc-clean-up-printks-fix-fix.patch

maintainer
#1 lore raw

PATCH 1/1 checkpatch: Improve CamelCase test for Page

Add the ClearPage/SetPage/TestClearPage/TestSetPage variants to the not reported Page CamelCase variables.

---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +1 -1
index 747bcd7..8a32306 100755
@@ -2930,7 +2930,7 @@ sub process {
 			my $var = $1;
 			if ($var !~ /$Constant/ &&
 			    $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ &&
-			    $var !~ /^Page[A-Z]/ &&
+			    $var !~ /"^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
 			    !defined $camelcase{$var}) {
 				$camelcase{$var} = 1;
 				WARN("CAMELCASE",
#2 lore raw

Re: [PATCH] checkpatch: Improve CamelCase test for Page

Quoted 14 lines · Joe Perches

Add the ClearPage/SetPage/TestClearPage/TestSetPage variants to the not reported Page CamelCase variables.

---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +0 -0
index 747bcd7..8a32306 100755

scripts/checkpatch.pl sub process { · line 2936

Quoted 8 lines
scripts/checkpatch.pl +1 -1
@@ -2930,7 +2930,7 @@ sub process {
 			my $var = $1;
 			if ($var !~ /$Constant/ &&
 			    $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ &&
-			    $var !~ /^Page[A-Z]/ &&
+			    $var !~ /"^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
 			    !defined $camelcase{$var}) {
 				$camelcase{$var} = 1;
 				WARN("CAMELCASE",

In a recent patch, checkpatch gave this warning.

WARNING: Avoid CamelCase: <tty->SAK_work>
#35: FILE: drivers/tty/tty_io.c:1475:
+ flush_work(&tty->SAK_work);

'SAK' is the acronym for 'Secure Attention Key'. Identifiers which relate to SAK handling have the above form; eg.,
do_SAK()
SAK_work
do_SAK_work
fn_SAK
vc_SAK
sysrq_handle_SAK

I didn't bother to mention it before, but since your addressing mm CamelCase exceptions, perhaps

xxxx_XXXX
xx_XXX_xxx
XXX_xxx

could be exceptions as well?

Regards,
Peter Hurley

#3 lore raw

Re: [PATCH] checkpatch: Improve CamelCase test for Page

Quoted 28 lines · On Fri, 22 Feb 2013 17:01:48 -0500 Peter Hurley <[email protected]>…
Quoted 14 lines · Joe Perches

Add the ClearPage/SetPage/TestClearPage/TestSetPage variants to the not reported Page CamelCase variables.

---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +0 -0
index 747bcd7..8a32306 100755

scripts/checkpatch.pl sub process { · line 2936

Quoted 8 lines
scripts/checkpatch.pl +1 -1
@@ -2930,7 +2930,7 @@ sub process {
 			my $var = $1;
 			if ($var !~ /$Constant/ &&
 			    $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ &&
-			    $var !~ /^Page[A-Z]/ &&
+			    $var !~ /"^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
 			    !defined $camelcase{$var}) {
 				$camelcase{$var} = 1;
 				WARN("CAMELCASE",

In a recent patch, checkpatch gave this warning.

WARNING: Avoid CamelCase: <tty->SAK_work>
#35: FILE: drivers/tty/tty_io.c:1475:

Review

Quoted 1 line
(quoted diff) +1 -0
+	flush_work(&tty->SAK_work);

If we start whitelisting these things, it will never end.

My (cruelly spurned) suggestion for this check is to grep the affected files to see if the symbol is already present and if so, don't warn.

Or just revert the whole thing. I get tons of camelcase warnings, and they're always unuseful/incorrect/ignored.

#4 lore raw

Re: [PATCH] checkpatch: Improve CamelCase test for Page

Quoted 35 lines · Andrew Morton
Quoted 28 lines · On Fri, 22 Feb 2013 17:01:48 -0500 Peter Hurley <[email protected]>…
Quoted 14 lines · Joe Perches

Add the ClearPage/SetPage/TestClearPage/TestSetPage variants to the not reported Page CamelCase variables.

---
 scripts/checkpatch.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/checkpatch.pl +0 -0
index 747bcd7..8a32306 100755

scripts/checkpatch.pl sub process { · line 2936

Quoted 8 lines
scripts/checkpatch.pl +1 -1
@@ -2930,7 +2930,7 @@ sub process {
 			my $var = $1;
 			if ($var !~ /$Constant/ &&
 			    $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ &&
-			    $var !~ /^Page[A-Z]/ &&
+			    $var !~ /"^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ &&
 			    !defined $camelcase{$var}) {
 				$camelcase{$var} = 1;
 				WARN("CAMELCASE",

In a recent patch, checkpatch gave this warning.

WARNING: Avoid CamelCase: <tty->SAK_work>
#35: FILE: drivers/tty/tty_io.c:1475:

Review

Quoted 1 line
(quoted diff) +1 -0
+	flush_work(&tty->SAK_work);

If we start whitelisting these things, it will never end.

Quoted 5 lines

My (cruelly spurned) suggestion for this check is to grep the affected files to see if the symbol is already present and if so, don't warn.

Or just revert the whole thing. I get tons of camelcase warnings, and they're always unuseful/incorrect/ignored.

Oh. I didn't know the impetus (although I had seen the mm variance and wondered :)

I don't have an opinion on this. It doesn't bother me, but I'm not my own maintainer.

maintainer
#5 lore raw

Re: [PATCH] checkpatch: Improve CamelCase test for Page

In reply to Peter Hurley
Quoted 8 lines · Peter Hurley

I didn't bother to mention it before, but since your addressing mm CamelCase exceptions, perhaps

xxxx_XXXX
xx_XXX_xxx
XXX_xxx

could be exceptions as well?

Maybe the check should only be for "[A-Z][a-z]|[a-z][A-Z]" to make '_' and any non-alpha char a name barrier.

So vars like A_foo or b_9A would be acceptable.

Maybe:

---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +2 -2
index 747bcd7..e08e9f6 100755
@@ -2929,8 +2929,8 @@ sub process {
 		while ($line =~ m{($Constant|$Lval)}g) {
 			my $var = $1;
 			if ($var !~ /$Constant/ &&
-			    $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ &&
-			    $var !~ /^Page[A-Z]/ &&
+			    $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
+			    $var !~ /"^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ && &&
 			    !defined $camelcase{$var}) {
 				$camelcase{$var} = 1;
 				WARN("CAMELCASE",
#6 lore raw

Re: [PATCH] checkpatch: Improve CamelCase test for Page

Quoted 26 lines · Joe Perches
Quoted 8 lines · Peter Hurley

I didn't bother to mention it before, but since your addressing mm CamelCase exceptions, perhaps

xxxx_XXXX
xx_XXX_xxx
XXX_xxx

could be exceptions as well?

Maybe the check should only be for "[A-Z][a-z]|[a-z][A-Z]" to make '_' and any non-alpha char a name barrier.

So vars like A_foo or b_9A would be acceptable.

Maybe:

---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +0 -0
index 747bcd7..e08e9f6 100755

scripts/checkpatch.pl sub process { · line 2933

Quoted 7 lines
scripts/checkpatch.pl +2 -2
@@ -2929,8 +2929,8 @@ sub process {
 		while ($line =~ m{($Constant|$Lval)}g) {
 			my $var = $1;
 			if ($var !~ /$Constant/ &&
-			    $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ &&
-			    $var !~ /^Page[A-Z]/ &&
+			    $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
+			    $var !~ /"^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ && &&
                                                                                    ^^^^^
                                                                                    &&  

scripts/checkpatch.pl sub process { · line 2936

Quoted 3 lines
scripts/checkpatch.pl +0 -0
 			    !defined $camelcase{$var}) {
 				$camelcase{$var} = 1;
 				WARN("CAMELCASE",

Other than that, works for me :)

#7 lore raw

Re: [PATCH] checkpatch: Improve CamelCase test for Page

In reply to Joe Perches
Quoted 28 lines · Joe Perches
Quoted 8 lines · Peter Hurley

I didn't bother to mention it before, but since your addressing mm CamelCase exceptions, perhaps

xxxx_XXXX
xx_XXX_xxx
XXX_xxx

could be exceptions as well?

Maybe the check should only be for "[A-Z][a-z]|[a-z][A-Z]" to make '_' and any non-alpha char a name barrier.

So vars like A_foo or b_9A would be acceptable.

Maybe:

---
 scripts/checkpatch.pl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/checkpatch.pl +0 -0
index 747bcd7..e08e9f6 100755

scripts/checkpatch.pl sub process { · line 2936

Quoted 10 lines
scripts/checkpatch.pl +2 -2
@@ -2929,8 +2929,8 @@ sub process {
                while ($line =~ m{($Constant|$Lval)}g) {
                        my $var = $1;
                        if ($var !~ /$Constant/ &&
-                           $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ &&
-                           $var !~ /^Page[A-Z]/ &&
+                           $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
+                           $var !~ /"^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ && &&
                            !defined $camelcase{$var}) {
                                $camelcase{$var} = 1;
                                WARN("CAMELCASE",

What are the guidelines on camelcase warnings on patches. A recent one I ran into is on a variable in a structure and fixing it would require changing the original variable.

WARNING: Avoid CamelCase: <cp->Header.SGList>
#67: FILE: drivers/scsi/hpsa.c:1409:
+ cp->Header.SGList = 0;

WARNING: Avoid CamelCase: <cp->Header.SGTotal>
#68: FILE: drivers/scsi/hpsa.c:1410:
+ cp->Header.SGTotal = 0;

total: 0 errors, 2 warnings, 11 lines checked

One would have to change a large portion of the code to fix it. In such cases, do we ignore this warning?

-- Shuah

maintainer
#8 lore raw

Re: [PATCH] checkpatch: Improve CamelCase test for Page

Quoted 3 lines · Shuah Khan

What are the guidelines on camelcase warnings on patches. A recent one I ran into is on a variable in a structure and fixing it would require changing the original variable.

The same as all other checkpatch warnings. Ignore the ones you don't agree with.

Errors maybe should be fixed. You should be able to ignore those too though.

Quoted 2 lines

One would have to change a large portion of the code to fix it. In such cases, do we ignore this warning?

Yes.

Taste is always author's choice.

Of course, lots of things depends on the upstream path and files you chose to work on.

If you're working in drivers/net, most of these warnings seem more likely to get patches that have them rejected.

If you're working on drivers/scsi, it seems you don't have to bother running checkpatch at all.

#9 lore raw

Re: [PATCH] checkpatch: Improve CamelCase test for Page

In reply to Shuah Khan
Quoted 30 lines · On Fri, 22 Feb 2013 15:57:16 -0700 Shuah Khan <[email protected]> wrote:
Quoted 7 lines
scripts/checkpatch.pl +0 -0
index 747bcd7..e08e9f6 100755

scripts/checkpatch.pl sub process { · line 2936

Quoted 10 lines
scripts/checkpatch.pl +2 -2
@@ -2929,8 +2929,8 @@ sub process {
                while ($line =~ m{($Constant|$Lval)}g) {
                        my $var = $1;
                        if ($var !~ /$Constant/ &&
-                           $var =~ /[A-Z]\w*[a-z]|[a-z]\w*[A-Z]/ &&
-                           $var !~ /^Page[A-Z]/ &&
+                           $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
+                           $var !~ /"^(?:Clear|Set|TestClear|TestSet|)Page[A-Z]/ && &&
                            !defined $camelcase{$var}) {
                                $camelcase{$var} = 1;
                                WARN("CAMELCASE",

What are the guidelines on camelcase warnings on patches. A recent one I ran into is on a variable in a structure and fixing it would require changing the original variable.

WARNING: Avoid CamelCase: <cp->Header.SGList>
#67: FILE: drivers/scsi/hpsa.c:1409:

(quoted diff) +1 -0
+		cp->Header.SGList = 0;

WARNING: Avoid CamelCase: <cp->Header.SGTotal>
#68: FILE: drivers/scsi/hpsa.c:1410:

(quoted diff) +1 -0
+		cp->Header.SGTotal = 0;
Quoted 4 lines

total: 0 errors, 2 warnings, 11 lines checked

One would have to change a large portion of the code to fix it. In such cases, do we ignore this warning?

Yes, ignore the warning. In my experience this is always the case, and it happens often.