From: Eugeniu Rosca <roscaeugeniu@gmail.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 1/1] image.h: use uint32_t instead of u32 in android_image_get_dtb*
Date: Sat, 7 Mar 2020 13:52:17 +0100 [thread overview]
Message-ID: <20200307125217.GA8620@erosca> (raw)
In-Reply-To: <20200307095344.9016-1-xypron.glpk@gmx.de>
Hello Heinrich,
Thank you for your perseverance.
I was just about to reply in https://patchwork.ozlabs.org/patch/1239098.
On Sat, Mar 07, 2020 at 10:53:44AM +0100, Heinrich Schuchardt wrote:
> From: Eugeniu Rosca <erosca@de.adit-jv.com>
>
> Replace 'u32' by 'uint32_t' in image.h, since the former may lead to
> build failures in U-Boot tooling (see [1]).
>
> Avoid using 'uint', since it is not a fixed-width type [2], potentially
> leading to a dangerous mismatch between the prototypes and definitions
> of the android_image_get_dtb* functions.
>
> This should be the quickest way to overcome the tooling build failure,
> with more future-proof solutions being proposed by Yamada-san in [1].
>
> [1] https://patchwork.ozlabs.org/patch/1238245/
> [2] Excerpt from https://en.cppreference.com/w/cpp/language/types
> -----------8<------------
> Type specifier Width in bits by data model
> LP32 ILP32 LLP64 LP64
> unsigned int 16 32 32 32
> -----------8<------------
>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Sam Protsenko <joe.skb7@gmail.com>
> Fixes: 7f2531502c74c0 ("image: android: Add routine to get dtbo params")
> Fixes: c3bfad825a71ea ("image: android: Add functions for handling dtb field")
> Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
> Signed-off-by: Eugeniu Rosca <erosca@de.adit-jv.com>
>
> Change the function parameters in the implementation to match the
> declaration in the header.
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
> v2:
> Change the function parameters in the implementation to match the
> declaration in the header.
> ---
> common/image-android.c | 6 +++---
> include/image.h | 6 +++---
> 2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/common/image-android.c b/common/image-android.c
> index 6af9baa121..3c3600b6f9 100644
> --- a/common/image-android.c
> +++ b/common/image-android.c
> @@ -216,7 +216,7 @@ int android_image_get_second(const struct andr_img_hdr *hdr,
> *
> * Return: true on success or false on error.
> */
> -bool android_image_get_dtbo(ulong hdr_addr, ulong *addr, u32 *size)
> +bool android_image_get_dtbo(ulong hdr_addr, ulong *addr, uint32_t *size)
I don't think it is a good idea to start making a soup of types in
Android code and, more generically, anywhere in U-Boot.
Starting with v4.2 commit [*], Linux formally prefers the
{u,s}{8,16,32,64} types. Since U-Boot benefits from the Linux alignment
in pretty much all subsystems, why not trying to follow the same policy?
Do you happen to see any alternative approach to this patch in the list
of options provided by Yamada-san in
https://patchwork.ozlabs.org/patch/1238245/#2363340 ?
[*] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e6176fa4728fb6d
("checkpatch: add --strict warning for c99 fixed size typedefs : int<size>_t")
--
Best Regards
Eugeniu Rosca
next prev parent reply other threads:[~2020-03-07 12:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-07 9:53 [PATCH v2 1/1] image.h: use uint32_t instead of u32 in android_image_get_dtb* Heinrich Schuchardt
2020-03-07 12:52 ` Eugeniu Rosca [this message]
2020-03-07 20:31 ` Heinrich Schuchardt
2020-03-08 0:16 ` Eugeniu Rosca
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200307125217.GA8620@erosca \
--to=roscaeugeniu@gmail.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox