summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2015-02-13 17:39:05 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-14 00:21:40 -0500
commit0f3c5aab5e00527eb3167aa9d1725cca9320e01e (patch)
treefb608e409b321504e831d79bb40ff327bb0e1827 /scripts
parenta2fe16b9d878a101b67678872e5cd1410c057ec0 (diff)
checkpatch: add of_device_id to structs that should be const
Uses of struct of_device_id are most commonly const. Suggest using it as such. Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/checkpatch.pl8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9c720e1261e9..d12435992dea 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5223,8 +5223,9 @@ sub process {
5223 "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr); 5223 "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
5224 } 5224 }
5225 5225
5226# check for various ops structs, ensure they are const. 5226# check for various structs that are normally const (ops, kgdb, device_tree)
5227 my $struct_ops = qr{acpi_dock_ops| 5227 my $const_structs = qr{
5228 acpi_dock_ops|
5228 address_space_operations| 5229 address_space_operations|
5229 backlight_ops| 5230 backlight_ops|
5230 block_device_operations| 5231 block_device_operations|
@@ -5247,6 +5248,7 @@ sub process {
5247 mtrr_ops| 5248 mtrr_ops|
5248 neigh_ops| 5249 neigh_ops|
5249 nlmsvc_binding| 5250 nlmsvc_binding|
5251 of_device_id|
5250 pci_raw_ops| 5252 pci_raw_ops|
5251 pipe_buf_operations| 5253 pipe_buf_operations|
5252 platform_hibernation_ops| 5254 platform_hibernation_ops|
@@ -5262,7 +5264,7 @@ sub process {
5262 usb_mon_operations| 5264 usb_mon_operations|
5263 wd_ops}x; 5265 wd_ops}x;
5264 if ($line !~ /\bconst\b/ && 5266 if ($line !~ /\bconst\b/ &&
5265 $line =~ /\bstruct\s+($struct_ops)\b/) { 5267 $line =~ /\bstruct\s+($const_structs)\b/) {
5266 WARN("CONST_STRUCT", 5268 WARN("CONST_STRUCT",
5267 "struct $1 should normally be const\n" . 5269 "struct $1 should normally be const\n" .
5268 $herecurr); 5270 $herecurr);