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>
This commit is contained in:
parent
a2fe16b9d8
commit
0f3c5aab5e
1 changed files with 5 additions and 3 deletions
|
@ -5223,8 +5223,9 @@ sub process {
|
||||||
"please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
|
"please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
|
||||||
}
|
}
|
||||||
|
|
||||||
# check for various ops structs, ensure they are const.
|
# check for various structs that are normally const (ops, kgdb, device_tree)
|
||||||
my $struct_ops = qr{acpi_dock_ops|
|
my $const_structs = qr{
|
||||||
|
acpi_dock_ops|
|
||||||
address_space_operations|
|
address_space_operations|
|
||||||
backlight_ops|
|
backlight_ops|
|
||||||
block_device_operations|
|
block_device_operations|
|
||||||
|
@ -5247,6 +5248,7 @@ sub process {
|
||||||
mtrr_ops|
|
mtrr_ops|
|
||||||
neigh_ops|
|
neigh_ops|
|
||||||
nlmsvc_binding|
|
nlmsvc_binding|
|
||||||
|
of_device_id|
|
||||||
pci_raw_ops|
|
pci_raw_ops|
|
||||||
pipe_buf_operations|
|
pipe_buf_operations|
|
||||||
platform_hibernation_ops|
|
platform_hibernation_ops|
|
||||||
|
@ -5262,7 +5264,7 @@ sub process {
|
||||||
usb_mon_operations|
|
usb_mon_operations|
|
||||||
wd_ops}x;
|
wd_ops}x;
|
||||||
if ($line !~ /\bconst\b/ &&
|
if ($line !~ /\bconst\b/ &&
|
||||||
$line =~ /\bstruct\s+($struct_ops)\b/) {
|
$line =~ /\bstruct\s+($const_structs)\b/) {
|
||||||
WARN("CONST_STRUCT",
|
WARN("CONST_STRUCT",
|
||||||
"struct $1 should normally be const\n" .
|
"struct $1 should normally be const\n" .
|
||||||
$herecurr);
|
$herecurr);
|
||||||
|
|
Loading…
Reference in a new issue