diff options
author | Simon Glass <sjg@chromium.org> | 2019-12-29 21:19:26 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-01-07 16:02:39 -0700 |
commit | 8d6320cc4d5cd01e2e7fd01dd635e360cf0a1699 (patch) | |
tree | f66bb23f1ed29ebfd925ee921e2fa975fefb2a6f /include/dm | |
parent | dc12ebbbdb765153805d2b17d18edf5fe0813d5a (diff) | |
download | u-boot-8d6320cc4d5cd01e2e7fd01dd635e360cf0a1699.tar.gz u-boot-8d6320cc4d5cd01e2e7fd01dd635e360cf0a1699.tar.xz u-boot-8d6320cc4d5cd01e2e7fd01dd635e360cf0a1699.zip |
dm: devres: Add tests
The devres functionality has very few users in U-Boot, but it still should
have tests. Add a few basic tests of the main functions.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm')
-rw-r--r-- | include/dm/devres.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/dm/devres.h b/include/dm/devres.h index 32fbf38054..9c69196054 100644 --- a/include/dm/devres.h +++ b/include/dm/devres.h @@ -15,6 +15,17 @@ typedef void (*dr_release_t)(struct udevice *dev, void *res); typedef int (*dr_match_t)(struct udevice *dev, void *res, void *match_data); +/** + * struct devres_stats - Information about devres allocations for a device + * + * @allocs: Number of allocations + * @total_size: Total size of allocations in bytes + */ +struct devres_stats { + int allocs; + int total_size; +}; + #ifdef CONFIG_DEVRES #ifdef CONFIG_DEBUG_DEVRES @@ -189,6 +200,9 @@ static inline void *devm_kcalloc(struct udevice *dev, */ void devm_kfree(struct udevice *dev, void *ptr); +/* Get basic stats on allocations */ +void devres_get_stats(const struct udevice *dev, struct devres_stats *stats); + #else /* ! CONFIG_DEVRES */ static inline void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp) @@ -265,5 +279,11 @@ static inline void devm_kfree(struct udevice *dev, void *ptr) { kfree(ptr); } + +static inline void devres_get_stats(const struct udevice *dev, + struct devres_stats *stats) +{ +} + #endif /* DEVRES */ #endif /* _DM_DEVRES_H */ |