Whamcloud - gitweb
LU-5160 build: warn on deprecated CFS_LIST_HEAD uses
[fs/lustre-release.git] / contrib / scripts / checkpatch.pl
index b766319..b91310a 100755 (executable)
@@ -404,7 +404,7 @@ my %dep_functions = (
        'cfs_inode_t',                  'struct inode',
 
        'CFS_INIT_LIST_HEAD',           'INIT_LIST_HEAD',
-       'CFS_LIST_HEAD',                'LIST_HEAD',
+       'CFS_LIST_HEAD',                'struct list_head foo = LIST_HEAD_INIT(foo);',
        'CFS_LIST_HEAD_INIT',           'LIST_HEAD_INIT',
        'cfs_list_add',                 'list_add',
        'cfs_list_add_tail',            'list_add_tail',
@@ -3091,6 +3091,27 @@ sub process {
                        }
                }
 
+# try to replace assertions with error handling
+               if ($line =~ /\bLASSERTF?\s*\(/) {
+                   WARN("LASSERT",
+                        "try to replace assertions with error handling\n" .
+                        $herecurr);
+               }
+
+# avoid new console messages
+               if ($line =~ /\bLCONSOLE[A-Z_]*\s*\(/) {
+                   WARN("LCONSOLE",
+                        "avoid adding new console messages\n" .
+                        $herecurr);
+               }
+
+# minimize new CERROR messages
+               if ($line =~ /\bC(EMERG|ERROR|NETERR|WARN)\s*\(/) {
+                   WARN("LCONSOLE",
+                        "think hard before adding new CERROR messages\n" .
+                        $herecurr);
+               }
+
 # no volatiles please
                my $asm_volatile = qr{\b(__asm__|asm)\s+(__volatile__|volatile)\b};
                if ($line =~ /\bvolatile\b/ && $line !~ /$asm_volatile/) {