[PATCH v5 5/6] sysinfo: rcar3: Use int instead of char for revision

Marek Vasut marek.vasut at mailbox.org
Sat Oct 7 23:32:24 CEST 2023


On 10/2/23 17:20, Detlev Casanova wrote:
> To be used with the sysinfo command, revision values must be considered
> as integers, not chars as some boards will implement BOARD_REVISION_*
> and might use numbers greater than 9.
> 
> Signed-off-by: Detlev Casanova <detlev.casanova at collabora.com>
> ---
>   drivers/sysinfo/rcar3.c | 73 ++++++++++++++++++++++-------------------
>   1 file changed, 39 insertions(+), 34 deletions(-)
> 
> diff --git a/drivers/sysinfo/rcar3.c b/drivers/sysinfo/rcar3.c
> index 7b127986da7..633e80bc19b 100644
> --- a/drivers/sysinfo/rcar3.c
> +++ b/drivers/sysinfo/rcar3.c
> @@ -68,8 +68,9 @@ static void sysinfo_rcar_parse(struct sysinfo_rcar_priv *priv)
>   	bool salvator_xs = false;
>   	bool ebisu_4d = false;
>   	bool condor_i = false;
> -	char rev_major = '?';
> -	char rev_minor = '?';
> +	char rev[4] = "?.?";
> +	u8 rev_major = 0;
> +	u8 rev_minor = 0;
>   
>   	switch (board_id) {
>   	case BOARD_SALVATOR_XS:
> @@ -77,81 +78,85 @@ static void sysinfo_rcar_parse(struct sysinfo_rcar_priv *priv)
>   		fallthrough;
>   	case BOARD_SALVATOR_X:
>   		if (!(board_rev & ~1)) { /* Only rev 0 and 1 is valid */
> -			rev_major = '1';
> -			rev_minor = '0' + (board_rev & BIT(0));
> +			rev_major = 1;
> +			rev_minor = board_rev & BIT(0);
> +			snprintf(rev, sizeof(rev), "%u.%u", rev_major, rev_minor);
>   		}
>   		snprintf(priv->boardmodel, sizeof(priv->boardmodel),
> -			 "Renesas Salvator-X%s board rev %c.%c",
> -			 salvator_xs ? "S" : "", rev_major, rev_minor);
> +			 "Renesas Salvator-X%s board rev %s",
> +			 salvator_xs ? "S" : "", rev);
> +
>   		return;

Extra newline got added just before the return here. If you want to do 
V6 with that fixed, that would be nice. In either case:

Reviewed-by: Marek Vasut <marek.vasut+renesas at mailbox.org>

Thanks !


More information about the U-Boot mailing list