diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-20 14:51:52 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-12-20 14:51:52 -0500 |
commit | 79bf7fc51118e4ffc61a0a8c943b94c394aa3ecc (patch) | |
tree | 037cb2a89f1e74f5b751a58135a5600fc43a04b5 | |
parent | 47e0ab3f39aec53d9b7ac77dbe11a645e40583f9 (diff) | |
parent | 92e112fdbb3cb55b43390426501a7efacd893b96 (diff) |
Merge branch 'pci/misc' into next
* pci/misc:
PCI/checkpatch: Deprecate DEFINE_PCI_DEVICE_TABLE
-rw-r--r-- | Documentation/PCI/pci.txt | 6 | ||||
-rw-r--r-- | include/linux/pci.h | 3 | ||||
-rwxr-xr-x | scripts/checkpatch.pl | 11 |
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 | ||
125 | The ID table is an array of struct pci_device_id entries ending with an | 125 | The ID table is an array of struct pci_device_id entries ending with an |
126 | all-zero entry; use of the macro DEFINE_PCI_DEVICE_TABLE is the preferred | 126 | all-zero entry. Definitions with static const are generally preferred. |
127 | method of declaring the table. Each entry consists of: | 127 | Use of the deprecated macro DEFINE_PCI_DEVICE_TABLE should be avoided. |
128 | |||
129 | Each 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 |