diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2015-07-25 21:52:37 +0900 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-08-06 07:44:29 -0600 |
commit | e2282d70763ddf06f9b02007445729c841ef4083 (patch) | |
tree | 8e0461a2455375eed3b66e1fc322fe265ce1e171 /include/dm/device-internal.h | |
parent | 2b07f6859ad17b74ce490f371f4878add6ae5a11 (diff) | |
download | u-boot-imx-e2282d70763ddf06f9b02007445729c841ef4083.zip u-boot-imx-e2282d70763ddf06f9b02007445729c841ef4083.tar.gz u-boot-imx-e2282d70763ddf06f9b02007445729c841ef4083.tar.bz2 |
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 'include/dm/device-internal.h')
-rw-r--r-- | include/dm/device-internal.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h index a2bf057..2cd2fe9 100644 --- a/include/dm/device-internal.h +++ b/include/dm/device-internal.h @@ -156,6 +156,8 @@ fdt_addr_t simple_bus_translate(struct udevice *dev, fdt_addr_t addr); #define DM_UCLASS_ROOT_NON_CONST (((gd_t *)gd)->uclass_root) /* device resource management */ +#ifdef CONFIG_DEVRES + /** * devres_release_probe - Release managed resources allocated after probing * @dev: Device to release resources for @@ -174,4 +176,15 @@ void devres_release_probe(struct udevice *dev); */ void devres_release_all(struct udevice *dev); +#else /* ! CONFIG_DEVRES */ + +static inline void devres_release_probe(struct udevice *dev) +{ +} + +static inline void devres_release_all(struct udevice *dev) +{ +} + +#endif /* ! CONFIG_DEVRES */ #endif |