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>
This commit is contained in:
Simon Glass
2019-12-29 21:19:26 -07:00
parent dc12ebbbdb
commit 8d6320cc4d
4 changed files with 212 additions and 0 deletions

View File

@@ -223,6 +223,19 @@ void dm_dump_devres(void)
if (root)
dump_resources(root, 0);
}
void devres_get_stats(const struct udevice *dev, struct devres_stats *stats)
{
struct devres *dr;
stats->allocs = 0;
stats->total_size = 0;
list_for_each_entry(dr, &dev->devres_head, entry) {
stats->allocs++;
stats->total_size += dr->size;
}
}
#endif
/*