aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Busch <keith.busch@intel.com>2016-05-03 10:58:11 -0400
committerBjorn Helgaas <bhelgaas@google.com>2016-05-03 10:58:11 -0400
commit6d81417da8720b393f670de9cce03a3642ea9a30 (patch)
treefd65db1a902ba99f3e5bef60a7e2ac02967e4aba
parent9735a22799b9214d17d3c231fe377fc852f042e9 (diff)
PCI: Widen portdrv service type from 4 bits to 8 bits
The names of port service devices previously used one nibble to encode the port type and another nibble to encode the service type. We're about to add a fifth service type, so change device names to use one *byte* to encode the service type. For example, a hotplug port service on a downstream bridge was previously called "pcie24" and is now called "pcie204". The "2" encodes the device type (PCI_EXP_TYPE_DOWNSTREAM - 4), and the "4" (now "04") encodes the service (PCIE_PORT_SERVICE_HP). Based on Lukas Wunner's patch: https://github.com/l1k/linux/commit/b688d6e4873ab082e5916b1a993bc1d38c6f4178 [bhelgaas: split to separate patch, expand changelog] Based-on-patch-by: Lukas Wunner <lukas@wunner.de> Signed-off-by: Keith Busch <keith.busch@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
-rw-r--r--drivers/pci/pcie/portdrv.h2
-rw-r--r--drivers/pci/pcie/portdrv_core.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/pcie/portdrv.h b/drivers/pci/pcie/portdrv.h
index d525548404d6..63cb2ef9c5ae 100644
--- a/drivers/pci/pcie/portdrv.h
+++ b/drivers/pci/pcie/portdrv.h
@@ -18,7 +18,7 @@
18 */ 18 */
19#define PCIE_PORT_MAX_MSIX_ENTRIES 32 19#define PCIE_PORT_MAX_MSIX_ENTRIES 32
20 20
21#define get_descriptor_id(type, service) (((type - 4) << 4) | service) 21#define get_descriptor_id(type, service) (((type - 4) << 8) | service)
22 22
23extern struct bus_type pcie_port_bus_type; 23extern struct bus_type pcie_port_bus_type;
24int pcie_port_device_register(struct pci_dev *dev); 24int pcie_port_device_register(struct pci_dev *dev);
diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
index 88122dc2e1b1..94d3b82415c1 100644
--- a/drivers/pci/pcie/portdrv_core.c
+++ b/drivers/pci/pcie/portdrv_core.c
@@ -338,7 +338,7 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq)
338 device = &pcie->device; 338 device = &pcie->device;
339 device->bus = &pcie_port_bus_type; 339 device->bus = &pcie_port_bus_type;
340 device->release = release_pcie_device; /* callback to free pcie dev */ 340 device->release = release_pcie_device; /* callback to free pcie dev */
341 dev_set_name(device, "%s:pcie%02x", 341 dev_set_name(device, "%s:pcie%03x",
342 pci_name(pdev), 342 pci_name(pdev),
343 get_descriptor_id(pci_pcie_type(pdev), service)); 343 get_descriptor_id(pci_pcie_type(pdev), service));
344 device->parent = &pdev->dev; 344 device->parent = &pdev->dev;