Skip to content

Commit 0f3c5aa

Browse files
JoePerchestorvalds
authored andcommitted
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>
1 parent a2fe16b commit 0f3c5aa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

scripts/checkpatch.pl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5223,8 +5223,9 @@ sub process {
52235223
"please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
52245224
}
52255225

5226-
# check for various ops structs, ensure they are const.
5227-
my $struct_ops = qr{acpi_dock_ops|
5226+
# check for various structs that are normally const (ops, kgdb, device_tree)
5227+
my $const_structs = qr{
5228+
acpi_dock_ops|
52285229
address_space_operations|
52295230
backlight_ops|
52305231
block_device_operations|
@@ -5247,6 +5248,7 @@ sub process {
52475248
mtrr_ops|
52485249
neigh_ops|
52495250
nlmsvc_binding|
5251+
of_device_id|
52505252
pci_raw_ops|
52515253
pipe_buf_operations|
52525254
platform_hibernation_ops|
@@ -5262,7 +5264,7 @@ sub process {
52625264
usb_mon_operations|
52635265
wd_ops}x;
52645266
if ($line !~ /\bconst\b/ &&
5265-
$line =~ /\bstruct\s+($struct_ops)\b/) {
5267+
$line =~ /\bstruct\s+($const_structs)\b/) {
52665268
WARN("CONST_STRUCT",
52675269
"struct $1 should normally be const\n" .
52685270
$herecurr);

0 commit comments

Comments
 (0)