mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM: zynqmp: use std_file_update as update handler
@ 2021-08-18 12:58 Michael Tretter
  2021-08-23 13:53 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Tretter @ 2021-08-18 12:58 UTC (permalink / raw)
  To: barebox

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@pengutronix.de>
Signed-off-by: Michael Tretter <m.tretter@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ARM: zynqmp: use std_file_update as update handler
  2021-08-18 12:58 [PATCH] ARM: zynqmp: use std_file_update as update handler Michael Tretter
@ 2021-08-23 13:53 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-08-23 13:53 UTC (permalink / raw)
  To: Michael Tretter; +Cc: barebox

On Wed, Aug 18, 2021 at 02:58:48PM +0200, Michael Tretter wrote:
> 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@pengutronix.de>
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
>  arch/arm/mach-zynqmp/zynqmp-bbu.c | 40 +++----------------------------
>  1 file changed, 3 insertions(+), 37 deletions(-)

Applied, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-23 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-18 12:58 [PATCH] ARM: zynqmp: use std_file_update as update handler Michael Tretter
2021-08-23 13:53 ` Sascha Hauer

mail archive of the barebox mailing list

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://lore.barebox.org/barebox/0 barebox/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 barebox barebox/ https://lore.barebox.org/barebox \
		barebox@lists.infradead.org
	public-inbox-index barebox

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git