aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/PCI/pci.txt6
-rw-r--r--include/linux/pci.h3
-rwxr-xr-xscripts/checkpatch.pl11
3 files changed, 12 insertions, 8 deletions
diff --git a/Documentation/PCI/pci.txt b/Documentation/PCI/pci.txt
index 6f458564d625..9518006f6675 100644
--- a/Documentation/PCI/pci.txt
+++ b/Documentation/PCI/pci.txt
@@ -123,8 +123,10 @@ initialization with a pointer to a structure describing the driver
123 123
124 124
125The ID table is an array of struct pci_device_id entries ending with an 125The ID table is an array of struct pci_device_id entries ending with an
126all-zero entry; use of the macro DEFINE_PCI_DEVICE_TABLE is the preferred 126all-zero entry. Definitions with static const are generally preferred.
127method of declaring the table. Each entry consists of: 127Use of the deprecated macro DEFINE_PCI_DEVICE_TABLE should be avoided.
128
129Each entry consists of:
128 130
129 vendor,device Vendor and device ID to match (or PCI_ANY_ID) 131 vendor,device Vendor and device ID to match (or PCI_ANY_ID)
130 132
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 9172cc2a3041..4b7cf4c954fe 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -635,8 +635,7 @@ struct pci_driver {
635 * DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table 635 * DEFINE_PCI_DEVICE_TABLE - macro used to describe a pci device table
636 * @_table: device table name 636 * @_table: device table name
637 * 637 *
638 * This macro is used to create a struct pci_device_id array (a device table) 638 * This macro is deprecated and should not be used in new code.
639 * in a generic manner.
640 */ 639 */
641#define DEFINE_PCI_DEVICE_TABLE(_table) \ 640#define DEFINE_PCI_DEVICE_TABLE(_table) \
642 const struct pci_device_id _table[] 641 const struct pci_device_id _table[]
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 9c9810030377..9fb30b15c9dc 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2634,10 +2634,13 @@ sub process {
2634 $herecurr); 2634 $herecurr);
2635 } 2635 }
2636 2636
2637# check for declarations of struct pci_device_id 2637# 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 annotations 2646# check for new typedefs, only function parameters and sparse annotations