Skip to content

Commit

Permalink
checkpatch: struct seq_operations should normally be const
Browse files Browse the repository at this point in the history
In the general use case struct seq_operations should be a const object.
Check for and warn where it is not.

Cc: Ingo Molnar <[email protected]>
Signed-off-by: Andy Whitcroft <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Andy Whitcroft authored and torvalds committed Jan 16, 2009
1 parent 3966778 commit 6903ffb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2527,9 +2527,10 @@ sub process {
WARN("please use device_initcall() instead of __initcall()\n" . $herecurr);
}
# check for struct file_operations, ensure they are const.
if ($line =~ /\bstruct\s+file_operations\b/ &&
$line !~ /\bconst\b/) {
WARN("struct file_operations should normally be const\n" . $herecurr);
if ($line !~ /\bconst\b/ &&
$line =~ /\bstruct\s+(file_operations|seq_operations)\b/) {
WARN("struct $1 should normally be const\n" .
$herecurr);
}

# use of NR_CPUS is usually wrong
Expand Down

0 comments on commit 6903ffb

Please sign in to comment.