From 1e0f226362ffd2bd8c1a238af1d1b21ea86d3111 Mon Sep 17 00:00:00 2001 From: Bin Meng Date: Fri, 11 Sep 2015 03:24:34 -0700 Subject: 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 Acked-by: Simon Glass --- include/dm/device.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include') diff --git a/include/dm/device.h b/include/dm/device.h index a239be6469..85196124b4 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); -- cgit v1.2.1