aboutsummaryrefslogtreecommitdiff
path: root/test/dm
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-04-19 12:14:01 +0900
committerTom Rini <trini@konsulko.com>2018-05-07 15:15:27 -0400
commit8c1de5e08b845eb71c9a247d16bc81ebdab0598d (patch)
tree3cfa1a137c58f01b0a658bc53d0efec5c1734aca /test/dm
parent9ce751a6f5d6683b0fabd3cfc62da7e9f30bc57f (diff)
downloadu-boot-8c1de5e08b845eb71c9a247d16bc81ebdab0598d.zip
u-boot-8c1de5e08b845eb71c9a247d16bc81ebdab0598d.tar.gz
u-boot-8c1de5e08b845eb71c9a247d16bc81ebdab0598d.tar.bz2
regmap: clean up regmap allocation
Putting zero length array at the end of struct is a common technique to embed arbitrary length of members. There is no good reason to let regmap_alloc_count() branch by "if (count <= 1)". As far as I understood the code, regmap->base is an alias of regmap->ranges[0].start, but it is not helpful but make the code just ugly. Rename regmap_alloc_count() to regmap_alloc() because the _count suffix seems pointless. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Simon Glass <sjg@chromium.org> [trini: fixup cpu_info-rcar.c] Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/regmap.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/test/dm/regmap.c b/test/dm/regmap.c
index abb718a..77b82ce 100644
--- a/test/dm/regmap.c
+++ b/test/dm/regmap.c
@@ -23,23 +23,20 @@ static int dm_test_regmap_base(struct unit_test_state *uts)
map = syscon_get_regmap(dev);
ut_assertok_ptr(map);
ut_asserteq(1, map->range_count);
- ut_asserteq(0x10, map->base);
- ut_asserteq(0x10, map->range->start);
- ut_asserteq(4, map->range->size);
- ut_asserteq_ptr(&map->base_range, map->range);
+ ut_asserteq(0x10, map->ranges[0].start);
+ ut_asserteq(4, map->ranges[0].size);
ut_asserteq(0x10, map_to_sysmem(regmap_get_range(map, 0)));
ut_assertok(uclass_get_device(UCLASS_SYSCON, 1, &dev));
map = syscon_get_regmap(dev);
ut_assertok_ptr(map);
ut_asserteq(4, map->range_count);
- ut_asserteq(0x20, map->base);
- ut_assert(&map->base_range != map->range);
+ ut_asserteq(0x20, map->ranges[0].start);
for (i = 0; i < 4; i++) {
const unsigned long addr = 0x20 + 8 * i;
- ut_asserteq(addr, map->range[i].start);
- ut_asserteq(5 + i, map->range[i].size);
+ ut_asserteq(addr, map->ranges[i].start);
+ ut_asserteq(5 + i, map->ranges[i].size);
ut_asserteq(addr, map_to_sysmem(regmap_get_range(map, i)));
}