aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-09-26 08:14:57 -0600
committerTom Rini <trini@konsulko.com>2023-10-06 14:38:13 -0400
commit61fc132051740e0378a5e71f3db6cb1581e970fe (patch)
treeb35fc3d4f145137d7ff88d7d2856c65c30f3c553
parent7f5ff034c32acd4481f4d6ce8118542f71c91b75 (diff)
downloadu-boot-61fc132051740e0378a5e71f3db6cb1581e970fe.zip
u-boot-61fc132051740e0378a5e71f3db6cb1581e970fe.tar.gz
u-boot-61fc132051740e0378a5e71f3db6cb1581e970fe.tar.bz2
dm: core: Tweak device_is_on_pci_bus() for code size
This function cannot return true if PCI is not enabled, since no PCI devices will have been bound. Add a check for this to reduce code size where it is used. Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r--include/dm/device.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/dm/device.h b/include/dm/device.h
index e54cb6b..add67f9 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -1005,7 +1005,8 @@ int dev_enable_by_path(const char *path);
*/
static inline bool device_is_on_pci_bus(const struct udevice *dev)
{
- return dev->parent && device_get_uclass_id(dev->parent) == UCLASS_PCI;
+ return CONFIG_IS_ENABLED(PCI) && dev->parent &&
+ device_get_uclass_id(dev->parent) == UCLASS_PCI;
}
/**