From mboxrd@z Thu Jan 1 00:00:00 1970 From: Simon Glass Date: Sun, 22 Apr 2018 20:11:27 +0000 Subject: [U-Boot] [PATCH 1/4] regmap: clean up regmap allocation In-Reply-To: <1524019125-26287-2-git-send-email-yamada.masahiro@socionext.com> References: <1524019125-26287-1-git-send-email-yamada.masahiro@socionext.com> <1524019125-26287-2-git-send-email-yamada.masahiro@socionext.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Masahiro, On 17 April 2018 at 20:38, Masahiro Yamada 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 > --- > > 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 Regards, Simon