summaryrefslogtreecommitdiff
path: root/drivers/core/device.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2015-07-25 12:52:37 (GMT)
committerSimon Glass <sjg@chromium.org>2015-08-06 13:44:29 (GMT)
commite2282d70763ddf06f9b02007445729c841ef4083 (patch)
tree8e0461a2455375eed3b66e1fc322fe265ce1e171 /drivers/core/device.c
parent2b07f6859ad17b74ce490f371f4878add6ae5a11 (diff)
downloadu-boot-e2282d70763ddf06f9b02007445729c841ef4083.tar.xz
devres: make Devres optional with CONFIG_DEVRES
Currently, Devres requires additional 16 byte for each allocation, which is not so insignificant in some cases. Add CONFIG_DEVRES to make this framework optional. If the option is disabled, devres functions fall back to non-managed variants. For example, devres_alloc() to kzalloc(), devm_kmalloc() to kmalloc(), etc. Because devres_head is also surrounded by an ifdef conditional, there is no memory overhead when CONFIG_DEVRES is disabled. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Suggested-by: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/core/device.c')
-rw-r--r--drivers/core/device.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c
index e3a42dc..caaf231 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;