From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Ashok Raj <ashok.raj@intel.com>,
Keith Busch <keith.busch@intel.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
Lukas Wunner <lukas@wunner.de>,
Michael Jamet <michael.jamet@intel.com>,
Yehezkel Bernat <yehezkel.bernat@intel.com>,
Mario.Limonciello@dell.com,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/7] PCI: Introduce pcie_upstream_port()
Date: Tue, 26 Sep 2017 17:17:15 +0300 [thread overview]
Message-ID: <20170926141720.25067-3-mika.westerberg@linux.intel.com> (raw)
In-Reply-To: <20170926141720.25067-1-mika.westerberg@linux.intel.com>
This helper allows to determine whether the PCI device is PCIe upstream
port.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
include/linux/pci.h | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f68c58a93dd0..4397692be538 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2042,6 +2042,17 @@ static inline int pci_pcie_type(const struct pci_dev *dev)
return (pcie_caps_reg(dev) & PCI_EXP_FLAGS_TYPE) >> 4;
}
+/**
+ * pcie_upstream_port - is the PCI device PCIe upstream port
+ * @dev: PCI device
+ */
+static inline bool pcie_upstream_port(struct pci_dev *dev)
+{
+ if (!pci_is_pcie(dev))
+ return false;
+ return pci_pcie_type(dev) == PCI_EXP_TYPE_UPSTREAM;
+}
+
static inline struct pci_dev *pcie_find_root_port(struct pci_dev *dev)
{
while (1) {
--
2.14.1
next prev parent reply other threads:[~2017-09-26 14:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-26 14:17 [PATCH 0/7] PCI: Improvements for native PCIe hotplug Mika Westerberg
2017-09-26 14:17 ` [PATCH 1/7] PCI: Do not allocate more buses than available in parent Mika Westerberg
2017-09-26 14:17 ` Mika Westerberg [this message]
2017-09-26 14:17 ` [PATCH 3/7] PCI: Distribute available buses to hotplug capable PCIe downstream ports Mika Westerberg
2017-10-11 23:32 ` Bjorn Helgaas
2017-10-12 9:50 ` David Laight
2017-10-12 12:47 ` Mika Westerberg
2017-10-12 18:32 ` Bjorn Helgaas
2017-10-13 10:26 ` Mika Westerberg
2017-09-26 14:17 ` [PATCH 4/7] PCI: Distribute available resources " Mika Westerberg
2017-09-26 14:17 ` [PATCH 5/7] PCI: pciehp: Fix race condition handling surprise link down Mika Westerberg
2017-09-26 14:17 ` [PATCH 6/7] PCI: pciehp: Do not clear Presence Detect Changed during initialization Mika Westerberg
2017-09-26 14:17 ` [PATCH 7/7] PCI: pciehp: Check that the device is really present before touching it Mika Westerberg
2017-10-09 8:47 ` [PATCH 0/7] PCI: Improvements for native PCIe hotplug Mika Westerberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170926141720.25067-3-mika.westerberg@linux.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=Mario.Limonciello@dell.com \
--cc=ashok.raj@intel.com \
--cc=bhelgaas@google.com \
--cc=keith.busch@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=michael.jamet@intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=yehezkel.bernat@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.