dfu: Call backend specific dfu_fill_*() only if enabled
PATCH 1/1 dfu: Call backend specific dfu_fill_*() only if enabled
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.
---
Cc: Lukasz Majewski <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
--- drivers/dfu/dfu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/dfu/dfu.c +6 -6
@@ -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 {
Signature · 1 line
2.35.1
Hi Marek
Quoted 37 lines · Marek Vasut
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 <[email protected]>---
Cc: Lukasz Majewski <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>--- drivers/dfu/dfu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/dfu/dfu.c +4
-4@@ -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))
drivers/dfu/dfu.c static int dfu_fill_entity(struct dfu_entity *dfu, char *s, int alt, · line 550
Quoted 10 lines
drivers/dfu/dfu.c +2
-2return -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 {
Thanks
Patrice
Hi Marek,
Quoted 37 lines · Marek Vasut
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 <[email protected]>---
Cc: Lukasz Majewski <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>--- drivers/dfu/dfu.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)drivers/dfu/dfu.c +4
-4@@ -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))
drivers/dfu/dfu.c static int dfu_fill_entity(struct dfu_entity *dfu, char *s, int alt, · line 550
Quoted 10 lines
drivers/dfu/dfu.c +2
-2return -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"
Regards
Patrick
Quoted 83 lines · Patrick DELAUNAY
Hi Marek,
Quoted 47 lines · Marek Vasut
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 <[email protected]>---
Cc: Lukasz Majewski <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
---
drivers/dfu/dfu.c| 12 ++++++------1 file changed, 6 insertions(+), 6 deletions(-)drivers/dfu/dfu.c +6
-6@@ -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,Quoted 4 lines
"virt")) {
if (dfu_fill_entity_virt(dfu, devstr, argv, argc)) return -1;
} else {All these DFU backend functions are stubbed in API =
include/dfu.hfor example:
#if
CONFIG_IS_ENABLED(DFU_MMC)
extern int dfu_fill_entity_mmc(structdfu_entity*dfu, char *devstr,
char **argv, int argc);
#else
static inline int dfu_fill_entity_mmc(structdfu_entity*dfu, char *devstr,
char **argv, int argc)
{
puts("MMC support not available!\n");
return -1;
}
#endifI 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)
Quoted 8 lines
it is a fixes for commit
ec44cace4b8d2("dfu: add DFU virtual backend")I just pushed this correction...
"dfu: Make DFU virtual backend SPL friendly"
That's even better, I'll review the other patch ... shortly ... sorry for the massive delays.