[PATCH] dfu: Call backend specific dfu_fill_*() only if enabled
Patrick DELAUNAY
patrick.delaunay at foss.st.com
Wed Nov 30 11:44:06 CET 2022
Hi Marek,
On 11/28/22 20:39, Marek Vasut wrote:
> The dfu_fill_*() functions are available only if the matching backend is
> enabled. Add missing CONFIG_IS_ENABLED() guard for each backend to prevent
> build errors, in case such a backend is enabled in U-Boot and not in SPL
> or vice versa.
>
> Signed-off-by: Marek Vasut <marex at denx.de>
> ---
> Cc: Lukasz Majewski <lukma at denx.de>
> Cc: Patrice Chotard <patrice.chotard at foss.st.com>
> Cc: Patrick Delaunay <patrick.delaunay at foss.st.com>
> ---
> drivers/dfu/dfu.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
> index 516dda61796..f9679d5ee52 100644
> --- a/drivers/dfu/dfu.c
> +++ b/drivers/dfu/dfu.c
> @@ -529,22 +529,22 @@ static int dfu_fill_entity(struct dfu_entity *dfu, char *s, int alt,
> dfu->free_entity = NULL;
>
> /* Specific for mmc device */
> - if (strcmp(interface, "mmc") == 0) {
> + if (CONFIG_IS_ENABLED(DFU_MMC) && !strcmp(interface, "mmc")) {
> if (dfu_fill_entity_mmc(dfu, devstr, argv, argc))
> return -1;
> - } else if (strcmp(interface, "mtd") == 0) {
> + } else if (CONFIG_IS_ENABLED(DFU_MTD) && !strcmp(interface, "mtd")) {
> if (dfu_fill_entity_mtd(dfu, devstr, argv, argc))
> return -1;
> - } else if (strcmp(interface, "nand") == 0) {
> + } else if (CONFIG_IS_ENABLED(DFU_NAND) && !strcmp(interface, "nand")) {
> if (dfu_fill_entity_nand(dfu, devstr, argv, argc))
> return -1;
> - } else if (strcmp(interface, "ram") == 0) {
> + } else if (CONFIG_IS_ENABLED(DFU_RAM) && !strcmp(interface, "ram")) {
> if (dfu_fill_entity_ram(dfu, devstr, argv, argc))
> return -1;
> - } else if (strcmp(interface, "sf") == 0) {
> + } else if (CONFIG_IS_ENABLED(DFU_SF) && !strcmp(interface, "sf")) {
> if (dfu_fill_entity_sf(dfu, devstr, argv, argc))
> return -1;
> - } else if (strcmp(interface, "virt") == 0) {
> + } else if (CONFIG_IS_ENABLED(DFU_VIRT) && !strcmp(interface, "virt")) {
> if (dfu_fill_entity_virt(dfu, devstr, argv, argc))
> return -1;
> } else {
All these DFU backend functions are stubbed in API = include/dfu.h
for example:
#if CONFIG_IS_ENABLED(DFU_MMC)
extern int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr,
char **argv, int argc);
#else
static inline int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *devstr,
char **argv, int argc)
{
puts("MMC support not available!\n");
return -1;
}
#endif
I think the only issue here is the test for CONFIG_DFU_VIRT
=> my patch which add this backend is not SPL friendly
- #ifdef CONFIG_DFU_VIRT
+ #if CONFIG_IS_ENABLED(DFU_VIRT)
it is a fixes for commit ec44cace4b8d2 ("dfu: add DFU virtual backend")
I just pushed this correction...
"dfu: Make DFU virtual backend SPL friendly"
http://patchwork.ozlabs.org/project/uboot/patch/20221130114146.1.I1944fc560e894329a83e9cf8f50cab3610f4f334@changeid/
Regards
Patrick
More information about the U-Boot
mailing list