diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2018-07-29 09:16:56 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2018-08-14 17:01:37 -0400 |
commit | b72ae8cac0caff86fe414fceb940655c2d1371c9 (patch) | |
tree | 38f1b9d5750af893eb3098e2ff921e7823fda1ef | |
parent | 546c596cf5491fda1516536e049c6a36836eb884 (diff) |
PCI: Add PCI_DEVICE_DATA() macro to fully describe device ID entry
There are a lot of examples in the kernel where PCI_VDEVICE() is used and
still looks not so convenient due to additional driver_data field attached.
Introduce PCI_DEVICE_DATA() macro to fully describe device ID entry in
shortest possible form. For example,
before:
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_MRFLD),
(kernel_ulong_t) &dwc3_pci_mrfld_properties, },
after:
{ PCI_DEVICE_DATA(INTEL, MRFLD, &dwc3_pci_mrfld_properties) },
Drivers can be converted later on in independent way.
While here, remove the unused macro with the same name from Ralink wireless
driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Kalle Valo <kvalo@codeaurora.org> # for rt2x00
-rw-r--r-- | drivers/net/wireless/ralink/rt2x00/rt2x00pci.h | 6 | ||||
-rw-r--r-- | include/linux/pci.h | 15 |
2 files changed, 15 insertions, 6 deletions
diff --git a/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h b/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h index bc0ca5f58f38..283e2e607bba 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h +++ b/drivers/net/wireless/ralink/rt2x00/rt2x00pci.h | |||
@@ -28,12 +28,6 @@ | |||
28 | #include <linux/pci.h> | 28 | #include <linux/pci.h> |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * This variable should be used with the | ||
32 | * pci_driver structure initialization. | ||
33 | */ | ||
34 | #define PCI_DEVICE_DATA(__ops) .driver_data = (kernel_ulong_t)(__ops) | ||
35 | |||
36 | /* | ||
37 | * PCI driver handlers. | 31 | * PCI driver handlers. |
38 | */ | 32 | */ |
39 | int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops); | 33 | int rt2x00pci_probe(struct pci_dev *pci_dev, const struct rt2x00_ops *ops); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 340029b2fb38..bf3665c534c2 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -819,6 +819,21 @@ struct pci_driver { | |||
819 | .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ | 819 | .vendor = PCI_VENDOR_ID_##vend, .device = (dev), \ |
820 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 | 820 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0 |
821 | 821 | ||
822 | /** | ||
823 | * PCI_DEVICE_DATA - macro used to describe a specific PCI device in very short form | ||
824 | * @vend: the vendor name (without PCI_VENDOR_ID_ prefix) | ||
825 | * @dev: the device name (without PCI_DEVICE_ID_<vend>_ prefix) | ||
826 | * @data: the driver data to be filled | ||
827 | * | ||
828 | * This macro is used to create a struct pci_device_id that matches a | ||
829 | * specific PCI device. The subvendor, and subdevice fields will be set | ||
830 | * to PCI_ANY_ID. | ||
831 | */ | ||
832 | #define PCI_DEVICE_DATA(vend, dev, data) \ | ||
833 | .vendor = PCI_VENDOR_ID_##vend, .device = PCI_DEVICE_ID_##vend##_##dev, \ | ||
834 | .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, 0, 0, \ | ||
835 | .driver_data = (kernel_ulong_t)(data) | ||
836 | |||
822 | enum { | 837 | enum { |
823 | PCI_REASSIGN_ALL_RSRC = 0x00000001, /* Ignore firmware setup */ | 838 | PCI_REASSIGN_ALL_RSRC = 0x00000001, /* Ignore firmware setup */ |
824 | PCI_REASSIGN_ALL_BUS = 0x00000002, /* Reassign all bus numbers */ | 839 | PCI_REASSIGN_ALL_BUS = 0x00000002, /* Reassign all bus numbers */ |