[PATCH] fixup! bootsource: allow DT aliases and bootrom numbering to differ

Johannes Zink j.zink at pengutronix.de
Wed Jul 20 02:29:39 PDT 2022


On Wed, 2022-07-20 at 10:32 +0200, Johannes Zink wrote:
> bootsource was used when src should have been instead. While at it,
> rename bs to src for alignment with other functions.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> Signed-off-by: Johannes Zink <j.zink at pengutronix.de>
> ---
>  common/bootsource.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/common/bootsource.c b/common/bootsource.c
> index d74c5e5cb..70bac945d 100644
> --- a/common/bootsource.c
> +++ b/common/bootsource.c
> @@ -33,9 +33,9 @@ static enum bootsource bootsource =
> BOOTSOURCE_UNKNOWN;
>  static int bootsource_instance = BOOTSOURCE_INSTANCE_UNKNOWN;
>  const char *bootsource_alias_name = NULL;
>  
> -const char *bootsource_get_alias_stem(enum bootsource bs)
> +const char *bootsource_get_alias_stem(enum bootsource src)
>  {
> -       switch (bs) {
> +       switch (src) {
>                 /*
>                  * For I2C and SPI EEPROMs we set the stem to be
> 'i2c'
>                  * and 'spi' correspondingly. The resulting alias
> will
> @@ -55,7 +55,7 @@ const char *bootsource_get_alias_stem(enum
> bootsource bs)
>         case BOOTSOURCE_MMC:    /* FALLTHROUGH */
>         case BOOTSOURCE_SPI:    /* FALLTHROUGH */
>         case BOOTSOURCE_CAN:
> -               return bootsource_str[bootsource];
> +               return bootsource_str[src];
>         default:
>                 return NULL;
>         }
> @@ -127,7 +127,7 @@ void bootsource_set_raw_instance(int instance)
>                 pr_setenv("bootsource_instance", "%d", instance);
>  }
>  
> -int bootsource_of_alias_xlate(enum bootsource bs, int instance)
> +int bootsource_of_alias_xlate(enum bootsource src, int instance)
>  {
>         char alias[sizeof("barebox,bootsource-harddisk4294967295")];
>         const char *bootsource_stem;
> @@ -137,11 +137,11 @@ int bootsource_of_alias_xlate(enum bootsource
> bs, int instance)
>         if (!IS_ENABLED(CONFIG_OFDEVICE))
>                 return BOOTSOURCE_INSTANCE_UNKNOWN;
>  
> -       if (bs == BOOTSOURCE_UNKNOWN ||
> +       if (src == BOOTSOURCE_UNKNOWN ||
>             instance == BOOTSOURCE_INSTANCE_UNKNOWN)
>                 return BOOTSOURCE_INSTANCE_UNKNOWN;
>  
> -       bootsource_stem = bootsource_get_alias_stem(bs);
> +       bootsource_stem = bootsource_get_alias_stem(src);
>         if (!bootsource_stem)
>                 return BOOTSOURCE_INSTANCE_UNKNOWN;
>  
> @@ -159,15 +159,15 @@ int bootsource_of_alias_xlate(enum bootsource
> bs, int instance)
>         return alias_id;
>  }
>  
> -int bootsource_set(enum bootsource bs, int instance)
> +int bootsource_set(enum bootsource src, int instance)
>  {
>         int alias_id;
>  
> -       alias_id = bootsource_of_alias_xlate(bs, instance);
> +       alias_id = bootsource_of_alias_xlate(src, instance);
>         if (alias_id == BOOTSOURCE_INSTANCE_UNKNOWN)
>                 alias_id = instance;
>  
> -       bootsource_set_raw(bs, alias_id);
> +       bootsource_set_raw(src, alias_id);
>  
>         return alias_id;
>  }

Tested-by: Johannes Zink <j.zink at pengutronix.de> # Radxa Rockpi3A
(RK3568)

-- 
Pengutronix e.K.                | Johannes Zink                  |
Steuerwalder Str. 21            | https://www.pengutronix.de/    |
31137 Hildesheim, Germany       | Phone: +49-5121-206917-0       |
Amtsgericht Hildesheim, HRA 2686| Fax:   +49-5121-206917-5555    |




More information about the barebox mailing list