checkpatch: Add dev_err_probe() to the list of Log Functions
PATCH 1/1 checkpatch: Add dev_err_probe() to the list of Log Functions
dev_err_probe() is missing in the list of Log Functions and hence checkpatch issues a warning in the cases when any other function in use won't trigger it. Add dev_err_probe() to the list to behave consistently.
--- scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+)
scripts/checkpatch.pl +1 -0
@@ -593,6 +593,7 @@ our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b}; our $logFunctions = qr{(?x: printk(?:_ratelimited|_once|_deferred_once|_deferred|)| (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| + dev_err_probe| TP_printk| WARN(?:_RATELIMIT|_ONCE|)| panic|
Signature · 1 line
2.43.0.rc1.1.gbec44491f096
Quoted 15 lines · Andy Shevchenko
dev_err_probe()is missing in the list of Log Functions and hence checkpatch issues a warning in the cases when any other function in use won't trigger it. Adddev_err_probe()to the list to behave consistently.Signed-off-by Andy Shevchenko <[email protected]>--- scripts/checkpatch.pl | 1 + 1 file changed, 1 insertion(+)scripts/checkpatch.pl +0
-0
scripts/checkpatch.pl our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b}; · line 599
Quoted 7 lines
scripts/checkpatch.pl +1
-0@@ -593,6 +593,7 @@ our $zero_initializer = qr{(?:(?:0[xX])?0+$Int_type?|NULL|false)\b}; our $logFunctions = qr{(?x: printk(?:_ratelimited|_once|_deferred_once|_deferred|)| (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)| + dev_err_probe| TP_printk| WARN(?:_RATELIMIT|_ONCE|)| panic|
Not sure if I agree. The difference here is that dev_err_probe() has two additional parameters ahead of the string. I would very much prefer to have those two additional parameters on a separate line if the string is too long to fit in 100 columns with those two parameters on the same line. In other words, I very much prefer
dev_err_probe(dev, -ESOMETHING, "very long string"); over dev_err_probe(dev, -ESOMETHING, "very long string");
and I don't really think that the latter has any benefits.
Also note that other dev_xxx() log functions are not included in the above test and would still generate warnings. Accepting
dev_err_probe(dev, -ESOMETHING, "very long string"); but not dev_err(dev, "very long string");
doesn't really make sense to me.
Guenter
Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Andy Shevchenko
dev_err_probe()is missing in the list of Log Functions and hence checkpatch issues a warning in the cases when any other function in use won't trigger it. Adddev_err_probe()to the list to behave consistently.
...
Quoted 11 lines
Not sure if I agree. The difference here is that
dev_err_probe()has two additional parameters ahead of the string. I would very much prefer to have those two additional parameters on a separate line if the string is too long to fit in 100 columns with those two parameters on the same line. In other words, I very much preferdev_err_probe(dev, -ESOMETHING, "very long string"); over dev_err_probe(dev, -ESOMETHING, "very long string");
Quoted 8 lines
and I don't really think that the latter has any benefits.
Also note that other
dev_xxx()log functions are not included in the above test and would still generate warnings. Acceptingdev_err_probe(dev, -ESOMETHING, "very long string"); but not dev_err(dev, "very long string");
They are included, see the line previous to the added one. (Regexp covers something like x_y_()* and x_*() families with the explicitly
listed * suffixes.)
That's why _this_ change makes it consistent.
Quoted 1 line
doesn't really make sense to me.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Andy Shevchenko
dev_err_probe()is missing in the list of Log Functions and hence checkpatch issues a warning in the cases when any other function in use won't trigger it. Adddev_err_probe()to the list to behave consistently.
...
Quoted 16 lines
Quoted 16 lines
Not sure if I agree. The difference here is that
dev_err_probe()has two additional parameters ahead of the string. I would very much prefer to have those two additional parameters on a separate line if the string is too long to fit in 100 columns with those two parameters on the same line. In other words, I very much preferdev_err_probe(dev, -ESOMETHING, "very long string"); over dev_err_probe(dev, -ESOMETHING, "very long string");and I don't really think that the latter has any benefits.
Also note that other
dev_xxx()log functions are not included in the above test and would still generate warnings. Accepting
Quoted 6 lines
Quoted 3 lines
dev_err_probe(dev, -ESOMETHING, "very long string"); but not dev_err(dev, "very long string");They are included, see the line previous to the added one. (Regexp covers something like x_y_()* and x_*() families with the explicitly
Should read: x_y_*()
Quoted 5 lines
listed * suffixes.)
That's why _this_ change makes it consistent.
Quoted 1 line
doesn't really make sense to me.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 29 lines · Andy Shevchenko
Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Andy Shevchenko
dev_err_probe()is missing in the list of Log Functions and hence checkpatch issues a warning in the cases when any other function in use won't trigger it. Adddev_err_probe()to the list to behave consistently....
Quoted 11 lines
Not sure if I agree. The difference here is that
dev_err_probe()has two additional parameters ahead of the string. I would very much prefer to have those two additional parameters on a separate line if the string is too long to fit in 100 columns with those two parameters on the same line. In other words, I very much preferdev_err_probe(dev, -ESOMETHING, "very long string"); over dev_err_probe(dev, -ESOMETHING, "very long string");Quoted 8 lines
and I don't really think that the latter has any benefits.
Also note that other
dev_xxx()log functions are not included in the above test and would still generate warnings. Acceptingdev_err_probe(dev, -ESOMETHING, "very long string"); but not dev_err(dev, "very long string");
Quoted 6 lines
They are included, see the line previous to the added one. (Regexp covers something like x_y_()* and x_*() families with the explicitly
listed * suffixes.)That's why _this_ change makes it consistent.
Hmm ok. Still don't like it.
Guenter
Quoted 7 lines · Guenter Roeck
Quoted 6 lines · Andy Shevchenko
Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Andy Shevchenko
dev_err_probe()is missing in the list of Log Functions and hence checkpatch issues a warning in the cases when any other function in use won't trigger it. Adddev_err_probe()to the list to behave consistently.
...
Quoted 20 lines
Quoted 20 lines
Quoted 19 lines
Not sure if I agree. The difference here is that
dev_err_probe()has two additional parameters ahead of the string. I would very much prefer to have those two additional parameters on a separate line if the string is too long to fit in 100 columns with those two parameters on the same line. In other words, I very much preferdev_err_probe(dev, -ESOMETHING, "very long string"); over dev_err_probe(dev, -ESOMETHING, "very long string");and I don't really think that the latter has any benefits.
Also note that other
dev_xxx()log functions are not included in the above test and would still generate warnings. Acceptingdev_err_probe(dev, -ESOMETHING, "very long string"); but not dev_err(dev, "very long string");
Quoted 8 lines
Quoted 6 lines
They are included, see the line previous to the added one. (Regexp covers something like x_y_()* and x_*() families with the explicitly
listed * suffixes.)That's why _this_ change makes it consistent.
Hmm ok. Still don't like it.
But then it's orthogonal to the change as with consistent behaviour you may propose a fix that makes sure that long string literal goes to a separate line (after a threshold) for _all_ of them at once. Currently the behaviour is inconsistent independently on somebody's preferences...
Signature · 2 lines
With Best Regards, Andy Shevchenko
Joe Perches
maintainerQuoted 2 lines · Andy Shevchenko
Currently the [style] behaviour is inconsistent independently on somebody's preferences...
<shrug> Which is IMO perfectly fine.
The ratio of multiple line and single line uses
of dev_err_probe is ~50:50
$ git grep -w dev_err_probe | grep -P ';\s*$' | wc -l 1532 $ git grep -w dev_err_probe | grep -P ',\s*$' | wc -l 1871
Quoted 6 lines · Joe Perches
Quoted 2 lines · Andy Shevchenko
Currently the [style] behaviour is inconsistent independently on somebody's preferences...
<shrug> Which is IMO perfectly fine.
Quoted 7 lines
The ratio of multiple line and single line uses
ofdev_err_probeis ~50:50$ git grep -w dev_err_probe | grep -P ';\s*$' | wc -l 1532 $ git grep -w dev_err_probe | grep -P ',\s*$' | wc -l 1871
My point is that checkpatch won't warn on dev_err(..., "very long line\n"); while doing the same on dev_err_probe() even if the line is shorter than in dev_err() case. This inconsistency I am talking about.
Signature · 2 lines
With Best Regards, Andy Shevchenko