History

PCI/checkpatch: Deprecate DEFINE_PCI_DEVICE_TABLE

Prefer use of the direct definition of struct pci_device_id instead of indirection via macro DEFINE_PCI_DEVICE_TABLE. Update the PCI documentation to deprecate DEFINE_PCI_DEVICE_TABLE. Update checkpatch adding --fix option.

Joe Perches committed 12 years ago

Commit 92e112f1 parent 5b764b83 files · +12 −8Browse files

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

Unified · Split

scripts/checkpatch.pl+7−4
@@ -2634,10 +2634,13 @@ sub process { · 2633 unmodified lines
2634 $herecurr);2634 $herecurr);
2635 }2635 }
2636 2636
2637# check for declarations of struct pci_device_id2637# check for uses of DEFINE_PCI_DEVICE_TABLE
2638 if ($line =~ /\bstruct\s+pci_device_id\s+\w+\s*\[\s*\]\s*\=\s*\{/) {2638 if ($line =~ /\bDEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=/) {
2639 WARN("DEFINE_PCI_DEVICE_TABLE",2639 if (WARN("DEFINE_PCI_DEVICE_TABLE",
2640 "Use DEFINE_PCI_DEVICE_TABLE for struct pci_device_id\n" . $herecurr);2640 "Prefer struct pci_device_id over deprecated DEFINE_PCI_DEVICE_TABLE\n" . $herecurr) &&
2641 $fix) {
2642 $fixed[$linenr - 1] =~ s/\b(?:static\s+|)DEFINE_PCI_DEVICE_TABLE\s*\(\s*(\w+)\s*\)\s*=\s*/static const struct pci_device_id $1\[\] = /;
2643 }
2641 }2644 }
2642 2645
2643# check for new typedefs, only function parameters and sparse annotations2646# check for new typedefs, only function parameters and sparse annotations