[OEM-B] [PATCH 5/7] PCI: Make pcie_downstream_port() available outside of access.c
Kai-Heng Feng
kai.heng.feng at canonical.com
Tue Nov 26 08:51:48 UTC 2019
From: Mika Westerberg <mika.westerberg at linux.intel.com>
BugLink: https://bugs.launchpad.net/bugs/1853991
pcie_downstream_port() is useful in other places where code needs to
determine whether the PCIe port is downstream so make it available outside
of access.c.
Link: https://lore.kernel.org/r/20190822085553.62697-1-mika.westerberg@linux.intel.com
Signed-off-by: Mika Westerberg <mika.westerberg at linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas at google.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko at linux.intel.com>
(backported from commit 984998e3404e9073479281dbba8af36b104e8c00)
Signed-off-by: Kai-Heng Feng <kai.heng.feng at canonical.com>
---
drivers/pci/access.c | 9 ---------
drivers/pci/pci.h | 9 +++++++++
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index 61a45bc0efc8..fbea43cd0c5f 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -701,15 +701,6 @@ static inline int pcie_cap_version(const struct pci_dev *dev)
return pcie_caps_reg(dev) & PCI_EXP_FLAGS_VERS;
}
-static bool pcie_downstream_port(const struct pci_dev *dev)
-{
- int type = pci_pcie_type(dev);
-
- return type == PCI_EXP_TYPE_ROOT_PORT ||
- type == PCI_EXP_TYPE_DOWNSTREAM ||
- type == PCI_EXP_TYPE_PCIE_BRIDGE;
-}
-
bool pcie_cap_has_lnkctl(const struct pci_dev *dev)
{
int type = pci_pcie_type(dev);
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index eccd932ecafb..a90c18982f20 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -108,6 +108,15 @@ static inline bool pci_power_manageable(struct pci_dev *pci_dev)
return !pci_has_subordinate(pci_dev) || pci_dev->bridge_d3;
}
+static inline bool pcie_downstream_port(const struct pci_dev *dev)
+{
+ int type = pci_pcie_type(dev);
+
+ return type == PCI_EXP_TYPE_ROOT_PORT ||
+ type == PCI_EXP_TYPE_DOWNSTREAM ||
+ type == PCI_EXP_TYPE_PCIE_BRIDGE;
+}
+
struct pci_vpd_ops {
ssize_t (*read)(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
ssize_t (*write)(struct pci_dev *dev, loff_t pos, size_t count, const void *buf);
--
2.17.1
More information about the kernel-team
mailing list