summaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2013-12-20 12:51:52 -0700
committerBjorn Helgaas <bhelgaas@google.com>2013-12-20 12:51:52 -0700
commit79bf7fc51118e4ffc61a0a8c943b94c394aa3ecc (patch)
tree037cb2a89f1e74f5b751a58135a5600fc43a04b5 /scripts/checkpatch.pl
parent47e0ab3f39aec53d9b7ac77dbe11a645e40583f9 (diff)
parent92e112fdbb3cb55b43390426501a7efacd893b96 (diff)
downloadop-kernel-dev-79bf7fc51118e4ffc61a0a8c943b94c394aa3ecc.zip
op-kernel-dev-79bf7fc51118e4ffc61a0a8c943b94c394aa3ecc.tar.gz
Merge branch 'pci/misc' into next
* pci/misc: PCI/checkpatch: Deprecate DEFINE_PCI_DEVICE_TABLE
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9c98100..9fb30b1 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2634,10 +2634,13 @@ sub process {
$herecurr);
}
-# check for declarations of struct pci_device_id
- if ($line =~ /\bstruct\s+pci_device_id\s+\w+\s*\[\s*\]\s*\=\s*\{/) {
- WARN("DEFINE_PCI_DEVICE_TABLE",
- "Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id\n" . $herecurr);
+# check for uses of DEFINE_PCI_DEVICE_TABLE
+ if ($line =~ /\bDEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=/) {
+ if (WARN("DEFINE_PCI_DEVICE_TABLE",
+ "Prefer struct pci_device_id over deprecated DEFINE_PCI_DEVICE_TABLE\n" . $herecurr) &&
+ $fix) {
+ $fixed[$linenr - 1] =~ s/\b(?:static\s+|)DEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=\s*/static const struct pci_device_id $1\[\] = /;
+ }
}
# check for new typedefs, only function parameters and sparse annotations
OpenPOWER on IntegriCloud