diff mbox

[U-Boot,v3,18/19] dfu: fix spl build

Message ID b344cd7c876b1489446a8df229faed4d520def34.1502906760.git.paweljarosz3691@gmail.com
State Superseded
Delegated to: Philipp Tomsich
Headers show

Commit Message

Paweł Jarosz Aug. 16, 2017, 6:39 p.m. UTC
In current state dfu depends on cmd/mtdparts.c which isn't build in SPL.
This patch resolves it by cutting out unwanted code in SPL build.

Signed-off-by: Paweł Jarosz <paweljarosz3691@gmail.com>
---
Changes since v1:
- none

Changes since v2:
- none

 drivers/dfu/dfu_nand.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Lukasz Majewski Aug. 17, 2017, 10:36 a.m. UTC | #1
Hi Paweł,

> In current state dfu depends on cmd/mtdparts.c which isn't build in SPL.
> This patch resolves it by cutting out unwanted code in SPL build.
>
> Signed-off-by: Paweł Jarosz <paweljarosz3691@gmail.com>
> ---
> Changes since v1:
> - none
>
> Changes since v2:
> - none
>
>  drivers/dfu/dfu_nand.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
> index 6dc9ff7..a196233 100644
> --- a/drivers/dfu/dfu_nand.c
> +++ b/drivers/dfu/dfu_nand.c
> @@ -192,8 +192,9 @@ unsigned int dfu_polltimeout_nand(struct dfu_entity *dfu)
>  int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s)
>  {
>  	char *st;
> +#ifndef CONFIG_SPL_BUILD
>  	int ret, dev, part;
> -
> +#endif
>  	dfu->data.nand.ubi = 0;
>  	dfu->dev_type = DFU_DEV_NAND;
>  	st = strsep(&s, " ");
> @@ -203,6 +204,7 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s)
>  		s++;
>  		dfu->data.nand.size = simple_strtoul(s, &s, 16);
>  	} else if ((!strcmp(st, "part")) || (!strcmp(st, "partubi"))) {
> +#ifndef CONFIG_SPL_BUILD
>  		char mtd_id[32];
>  		struct mtd_device *mtd_dev;
>  		u8 part_num;
> @@ -220,6 +222,7 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s)
>  		mtdparts_init();
>
>  		ret = find_dev_and_part(mtd_id, &mtd_dev, &part_num, &pi);
> +

I think that this blank line is not needed.

Otherwise,

Acked-by: Łukasz Majewski <lukma@denx.de>

>  		if (ret != 0) {
>  			printf("Could not locate '%s'\n", mtd_id);
>  			return -1;
> @@ -229,6 +232,7 @@ int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s)
>  		dfu->data.nand.size = pi->size;
>  		if (!strcmp(st, "partubi"))
>  			dfu->data.nand.ubi = 1;
> +#endif
>  	} else {
>  		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
>  		return -1;
>
diff mbox

Patch

diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
index 6dc9ff7..a196233 100644
--- a/drivers/dfu/dfu_nand.c
+++ b/drivers/dfu/dfu_nand.c
@@ -192,8 +192,9 @@  unsigned int dfu_polltimeout_nand(struct dfu_entity *dfu)
 int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s)
 {
 	char *st;
+#ifndef CONFIG_SPL_BUILD
 	int ret, dev, part;
-
+#endif
 	dfu->data.nand.ubi = 0;
 	dfu->dev_type = DFU_DEV_NAND;
 	st = strsep(&s, " ");
@@ -203,6 +204,7 @@  int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s)
 		s++;
 		dfu->data.nand.size = simple_strtoul(s, &s, 16);
 	} else if ((!strcmp(st, "part")) || (!strcmp(st, "partubi"))) {
+#ifndef CONFIG_SPL_BUILD
 		char mtd_id[32];
 		struct mtd_device *mtd_dev;
 		u8 part_num;
@@ -220,6 +222,7 @@  int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s)
 		mtdparts_init();
 
 		ret = find_dev_and_part(mtd_id, &mtd_dev, &part_num, &pi);
+
 		if (ret != 0) {
 			printf("Could not locate '%s'\n", mtd_id);
 			return -1;
@@ -229,6 +232,7 @@  int dfu_fill_entity_nand(struct dfu_entity *dfu, char *devstr, char *s)
 		dfu->data.nand.size = pi->size;
 		if (!strcmp(st, "partubi"))
 			dfu->data.nand.ubi = 1;
+#endif
 	} else {
 		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
 		return -1;