[PATCH] ARM: zynqmp: use std_file_update as update handler

Michael Tretter m.tretter at pengutronix.de
Wed Aug 18 05:58:48 PDT 2021


The update handler for zynqmp copies the boot.bin file into an existing
fat partition. There is already a better implementation by
bbu_register_std_file_update(). Drop the custom implementation.

Keep the previous functions with its signature to have an obvious common
update handler for all ZynqMP boards.

Suggested-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter at pengutronix.de>
---
 arch/arm/mach-zynqmp/zynqmp-bbu.c | 40 +++----------------------------
 1 file changed, 3 insertions(+), 37 deletions(-)

diff --git a/arch/arm/mach-zynqmp/zynqmp-bbu.c b/arch/arm/mach-zynqmp/zynqmp-bbu.c
index d1197c01dc41..7ac8c2b8a994 100644
--- a/arch/arm/mach-zynqmp/zynqmp-bbu.c
+++ b/arch/arm/mach-zynqmp/zynqmp-bbu.c
@@ -4,45 +4,11 @@
  */
 
 #include <common.h>
-#include <libfile.h>
 #include <mach/zynqmp-bbu.h>
 
-static int zynqmp_bbu_handler(struct bbu_handler *handler,
-		struct bbu_data *data)
-{
-	int ret = 0;
-
-	ret = bbu_confirm(data);
-	if (ret)
-		return ret;
-
-	ret = copy_file(data->imagefile, data->devicefile, 1);
-	if (ret < 0) {
-		pr_err("update failed: %s", strerror(-ret));
-		return ret;
-	}
-
-	return ret;
-}
-
 int zynqmp_bbu_register_handler(const char *name, char *devicefile,
-		unsigned long flags)
+				unsigned long flags)
 {
-	struct bbu_handler *handler;
-	int ret = 0;
-
-	if (!name || !devicefile)
-		return -EINVAL;
-
-	handler = xzalloc(sizeof(*handler));
-	handler->name = name;
-	handler->devicefile = devicefile;
-	handler->flags = flags;
-	handler->handler = zynqmp_bbu_handler;
-
-	ret = bbu_register_handler(handler);
-	if (ret)
-		free(handler);
-
-	return ret;
+	return bbu_register_std_file_update(name, flags, devicefile,
+					    filetype_zynq_image);
 }
-- 
2.30.2




More information about the barebox mailing list