From: Jacob Keller <[email protected]>
The previous logFunction regular expression allowed names for log functions like
dev_warn or e_dbg and so forth, but some log functions are of the forms
similar to e_dev_warn, (adding an additional tag in front of a standard name
like dev_warn).
This patch modifies checkpatch to enable use of this type of log function name.
Signed-off-by: Jacob Keller <[email protected]>
Tested-by: Aaron Brown <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
---
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b954de5..a38d71e 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -269,7 +269,7 @@ our $typeTypedefs = qr{(?x:
our $logFunctions = qr{(?x:
printk(?:_ratelimited|_once|)|
- [a-z0-9]+_(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
+ (?:[a-z0-9]+_)+(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
WARN(?:_RATELIMIT|_ONCE|)|
panic|
MODULE_[A-Z_]+
--
1.7.11.7
On Wed, 2013-06-19 at 03:38 -0700, Jeff Kirsher wrote:
> From: Jacob Keller <[email protected]>
>
> The previous logFunction regular expression allowed names for log functions like
> dev_warn or e_dbg and so forth, but some log functions are of the forms
> similar to e_dev_warn, (adding an additional tag in front of a standard name
> like dev_warn).
Perhaps names like foo_bar_baz_dev_warn are a bit long.
Maybe instead of
+ (?:[a-z0-9]+_)+(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
use
+ (?:[a-z0-9]+_){0,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
> -----Original Message-----
> From: Joe Perches [mailto:[email protected]]
> Sent: Wednesday, June 19, 2013 6:42 AM
> To: Kirsher, Jeffrey T
> Cc: [email protected]; Keller, Jacob E; [email protected];
> [email protected]
> Subject: Re: [net] checkpatch: modify logFunction regular expression to
> allow repeated front tags
>
> On Wed, 2013-06-19 at 03:38 -0700, Jeff Kirsher wrote:
> > From: Jacob Keller <[email protected]>
> >
> > The previous logFunction regular expression allowed names for log
> functions like
> > dev_warn or e_dbg and so forth, but some log functions are of the
> forms
> > similar to e_dev_warn, (adding an additional tag in front of a standard
> name
> > like dev_warn).
>
> Perhaps names like foo_bar_baz_dev_warn are a bit long.
>
> Maybe instead of
> + (?:[a-z0-
> 9]+_)+(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug
> |dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
> use
> + (?:[a-z0-
> 9]+_){0,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|de
> bug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
>
That sounds good to me.
- Jake
From: Jacob Keller <[email protected]>
The current $logFunction regular expression allows names like
dev_warn, e_dbg, netdev_info, etc, but some log functions are now
written like e_dev_warn, so allow 1 or 2 word blocks with an
underscore before the logging level.
Signed-off-by: Jacob Keller <[email protected]>
Tested-by: Aaron Brown <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
Signed-off-by: Joe Perches <[email protected]>
---
jp: Modified Jacob's patch and commit message to limit the number of
word blocks because foo_bar_baz_dev_warn is just too long to live.
scripts/checkpatch.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7e8aa1b..1034c9b 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -280,7 +280,7 @@ our $typeTypedefs = qr{(?x:
our $logFunctions = qr{(?x:
printk(?:_ratelimited|_once|)|
- [a-z0-9]+_(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
+ (?:[a-z0-9]+_){1,2}(?:printk|emerg|alert|crit|err|warning|warn|notice|info|debug|dbg|vdbg|devel|cont|WARN)(?:_ratelimited|_once|)|
WARN(?:_RATELIMIT|_ONCE|)|
panic|
MODULE_[A-Z_]+
--
1.8.1.2.459.gbcd45b4.dirty