[U-Boot] [PATCH 2/3] dfu: add static alt num count in dfu_config_entities()

Lukasz Majewski l.majewski at samsung.com
Mon Mar 31 10:48:48 CEST 2014


From: Przemyslaw Marczak <p.marczak at samsung.com>

Thanks to this multiple calls of function dfu_config_entities() give continuous
dfu alt numbering until call dfu_free_entities().

This allows to store dfu entities in multiple env variables.

Change-Id: Ibca7e785bfca9f53b64d3dff0490185b06841b54
Signed-off-by: Przemyslaw Marczak <p.marczak at samsung.com>
---
 drivers/dfu/dfu.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index f94c412..e15f959 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -19,6 +19,7 @@
 static bool dfu_reset_request;
 static LIST_HEAD(dfu_list);
 static int dfu_alt_num;
+static int alt_num_count;
 
 bool dfu_reset(void)
 {
@@ -379,6 +380,8 @@ void dfu_free_entities(void)
 	if (t)
 		free(t);
 	INIT_LIST_HEAD(&dfu_list);
+
+	alt_num_count = 0;
 }
 
 int dfu_config_entities(char *env, char *interface, int num)
@@ -396,11 +399,12 @@ int dfu_config_entities(char *env, char *interface, int num)
 	for (i = 0; i < dfu_alt_num; i++) {
 
 		s = strsep(&env, ";");
-		ret = dfu_fill_entity(&dfu[i], s, i, interface, num);
+		ret = dfu_fill_entity(&dfu[i], s, alt_num_count, interface, num);
 		if (ret)
 			return -1;
 
 		list_add_tail(&dfu[i].list, &dfu_list);
+		alt_num_count++;
 	}
 
 	return 0;
-- 
1.7.10.4



More information about the U-Boot mailing list