History

checkpatch: handle EXPORT_SYMBOL for DEVICE_ATTR and similar

Handly definitions similar to below. The definition macro spits out a symbol with a prefix. Add matching of any identifier prefix: DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR, ata_scsi_lpm_show, ata_scsi_lpm_put); EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy);

Andy Whitcroft committed 16 years ago

Commit 3cbf62d1 parent 5eaa20b1 file · +10 −1Browse files

Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all

Unified · Split

scripts/checkpatch.pl+10−1
@@ -1822,8 +1822,17 @@ sub process { · 1821 unmodified lines
1822 !defined $suppress_export{$realline_next} &&1822 !defined $suppress_export{$realline_next} &&
1823 ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/ ||1823 ($lines[$realline_next - 1] =~ /EXPORT_SYMBOL.*\((.*)\)/ ||
1824 $lines[$realline_next - 1] =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {1824 $lines[$realline_next - 1] =~ /EXPORT_UNUSED_SYMBOL.*\((.*)\)/)) {
1825 # Handle definitions which produce identifiers with
1826 # a prefix:
1827 # XXX(foo);
1828 # EXPORT_SYMBOL(something_foo);
1825 my $name = $1;1829 my $name = $1;
1826 if ($stat !~ /(?:1830 if ($stat =~ /^.([A-Z_]+)\s*\(\s*($Ident)/ &&
1831 $name =~ /^${Ident}_$2/) {
1832#print "FOO C name<$name>\n";
1833 $suppress_export{$realline_next} = 1;
1834
1835 } elsif ($stat !~ /(?:
1827 \n.}\s*$|1836 \n.}\s*$|
1828 ^.DEFINE_$Ident\(\Q$name\E\)|1837 ^.DEFINE_$Ident\(\Q$name\E\)|
1829 ^.DECLARE_$Ident\(\Q$name\E\)|1838 ^.DECLARE_$Ident\(\Q$name\E\)|