summaryrefslogtreecommitdiffstats
path: root/drivers/core
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/core')
-rw-r--r--drivers/core/Kconfig15
-rw-r--r--drivers/core/Makefile3
-rw-r--r--drivers/core/device.c2
3 files changed, 18 insertions, 2 deletions
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index a002d69d79..8ae0072aa9 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -79,9 +79,22 @@ config SYSCON
by this uclass, including accessing registers via regmap and
assigning a unique number to each.
+config DEVRES
+ bool "Managed device resources"
+ depends on DM
+ help
+ This option enables the Managed device resources core support.
+ Device resources managed by the devres framework are automatically
+ released whether initialization fails half-way or the device gets
+ detached.
+
+ If this option is disabled, devres functions fall back to
+ non-managed variants. For example, devres_alloc() to kzalloc(),
+ devm_kmalloc() to kmalloc(), etc.
+
config DEBUG_DEVRES
bool "Managed device resources verbose debug messages"
- depends on DM
+ depends on DEVRES
help
If this option is enabled, devres debug messages are printed.
Select this if you are having a problem with devres or want to
diff --git a/drivers/core/Makefile b/drivers/core/Makefile
index 260833e8ee..ccc2fd4e21 100644
--- a/drivers/core/Makefile
+++ b/drivers/core/Makefile
@@ -4,7 +4,8 @@
# SPDX-License-Identifier: GPL-2.0+
#
-obj-y += device.o lists.o root.o uclass.o util.o devres.o
+obj-y += device.o lists.o root.o uclass.o util.o
+obj-$(CONFIG_DEVRES) += devres.o
ifndef CONFIG_SPL_BUILD
obj-$(CONFIG_OF_CONTROL) += simple-bus.o
endif
diff --git a/drivers/core/device.c b/drivers/core/device.c
index e3a42dc928..caaf231921 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -47,7 +47,9 @@ int device_bind(struct udevice *parent, const struct driver *drv,
INIT_LIST_HEAD(&dev->sibling_node);
INIT_LIST_HEAD(&dev->child_head);
INIT_LIST_HEAD(&dev->uclass_node);
+#ifdef CONFIG_DEVRES
INIT_LIST_HEAD(&dev->devres_head);
+#endif
dev->platdata = platdata;
dev->name = name;
dev->of_offset = of_offset;
OpenPOWER on IntegriCloud