[U-Boot] [PATCH 1/4] regmap: clean up regmap allocation

Simon Glass sjg at chromium.org
Sun Apr 22 20:11:27 UTC 2018


Hi Masahiro,

On 17 April 2018 at 20:38, Masahiro Yamada <yamada.masahiro at socionext.com>
wrote:
> 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 at socionext.com>
> ---
>
>  drivers/core/regmap.c | 31 +++++++++----------------------
>  include/regmap.h      |  7 ++-----
>  2 files changed, 11 insertions(+), 27 deletions(-)

This seems fine to me and does not increase the number of allocations.

Reviewed-by: Simon Glass <sjg at chromium.org>

Regards,
Simon


More information about the U-Boot mailing list