summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBin Meng <bmeng.cn@gmail.com>2015-09-11 03:24:34 -0700
committerSimon Glass <sjg@chromium.org>2015-09-16 19:53:52 -0600
commit1e0f226362ffd2bd8c1a238af1d1b21ea86d3111 (patch)
tree105e275db286d90bcf54a593536bf3012823f9c6 /include
parentfa43ce842c3026c2abf19d4234d02cd4c62eeec0 (diff)
downloadu-boot-imx-1e0f226362ffd2bd8c1a238af1d1b21ea86d3111.zip
u-boot-imx-1e0f226362ffd2bd8c1a238af1d1b21ea86d3111.tar.gz
u-boot-imx-1e0f226362ffd2bd8c1a238af1d1b21ea86d3111.tar.bz2
dm: pci: Add an inline API to test if a device is on a PCI bus
Introduce device_is_on_pci_bus() which can be utilized by driver to test if a device is on a PCI bus. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/dm/device.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/dm/device.h b/include/dm/device.h
index a239be6..8519612 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -485,6 +485,17 @@ bool device_is_last_sibling(struct udevice *dev);
*/
int device_set_name(struct udevice *dev, const char *name);
+/**
+ * device_is_on_pci_bus - Test if a device is on a PCI bus
+ *
+ * @dev: device to test
+ * @return: true if it is on a PCI bus, false otherwise
+ */
+static inline bool device_is_on_pci_bus(struct udevice *dev)
+{
+ return device_get_uclass_id(dev->parent) == UCLASS_PCI;
+}
+
/* device resource management */
typedef void (*dr_release_t)(struct udevice *dev, void *res);
typedef int (*dr_match_t)(struct udevice *dev, void *res, void *match_data);