From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/4] ARM: i.MX: bbu-internal: factor out a prereq function
Date: Tue, 6 Aug 2013 15:42:51 +0200 [thread overview]
Message-ID: <1375796574-8759-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1375796574-8759-1-git-send-email-s.hauer@pengutronix.de>
To elminate some code duplication.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-imx/imx-bbu-internal.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index bbc620a..70b7c44 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -103,6 +103,22 @@ err_close:
return ret;
}
+static int imx_bbu_check_prereq(struct bbu_data *data)
+{
+ int ret;
+
+ if (file_detect_type(data->image, data->len) != filetype_arm_barebox) {
+ if (!bbu_force(data, "Not an ARM barebox image"))
+ return -EINVAL;
+ }
+
+ ret = bbu_confirm(data);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
/*
* Update barebox on a v1 type internal boot (i.MX25, i.MX35, i.MX51)
*
@@ -122,12 +138,7 @@ static int imx_bbu_internal_v1_update(struct bbu_handler *handler, struct bbu_da
int ret, image_len;
void *buf;
- if (file_detect_type(data->image, data->len) != filetype_arm_barebox) {
- if (!bbu_force(data, "Not an ARM barebox image"))
- return -EINVAL;
- }
-
- ret = bbu_confirm(data);
+ ret = imx_bbu_check_prereq(data);
if (ret)
return ret;
@@ -344,12 +355,7 @@ static int imx_bbu_internal_v2_update(struct bbu_handler *handler, struct bbu_da
int ret, image_len;
void *buf;
- if (file_detect_type(data->image, data->len) != filetype_arm_barebox) {
- if (!bbu_force(data, "Not an ARM barebox image"))
- return -EINVAL;
- }
-
- ret = bbu_confirm(data);
+ ret = imx_bbu_check_prereq(data);
if (ret)
return ret;
--
1.8.4.rc1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2013-08-06 13:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-06 13:42 [PATCH] DFI FS700-FS60 board support Sascha Hauer
2013-08-06 13:42 ` Sascha Hauer [this message]
2013-08-06 13:42 ` [PATCH 2/4] ARM: i.MX: bbu-internal: optionally use DCD data from image Sascha Hauer
2013-08-06 13:42 ` [PATCH 3/4] ARM: dts: imx: share pad macro names between imx6q and imx6dl Sascha Hauer
2013-08-06 13:42 ` [PATCH 4/4] ARM: i.MX6: Add dfi fs700 m60 i.MX6 Q7 board support Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1375796574-8759-2-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox