mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
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>
This commit is contained in:
committed by
Tom Rini
parent
9ce751a6f5
commit
8c1de5e08b
@@ -21,15 +21,12 @@ struct regmap_range {
|
||||
/**
|
||||
* struct regmap - a way of accessing hardware/bus registers
|
||||
*
|
||||
* @base: Base address of register map
|
||||
* @range_count: Number of ranges available within the map
|
||||
* @range: Pointer to the list of ranges, allocated if @range_count > 1
|
||||
* @base_range: If @range_count is <= 1, @range points here
|
||||
* @ranges: Array of ranges
|
||||
*/
|
||||
struct regmap {
|
||||
phys_addr_t base;
|
||||
int range_count;
|
||||
struct regmap_range *range, base_range;
|
||||
struct regmap_range ranges[0];
|
||||
};
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user