From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 3/6] ARM: i.MX: bbu: Share MMC code between i.MX51 and 53
Date: Tue, 12 Jun 2018 11:43:13 -0700 [thread overview]
Message-ID: <20180612184316.4579-5-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20180612184316.4579-1-andrew.smirnov@gmail.com>
Both functions do exactly the same thing with only difference being
type of hanler they pass one. Convert the code to use a generic
function accpeting handler as additional parameter.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
arch/arm/mach-imx/imx-bbu-internal.c | 32 +++++++++++++++-------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-imx/imx-bbu-internal.c b/arch/arm/mach-imx/imx-bbu-internal.c
index 07a26f25a..b4e78aea4 100644
--- a/arch/arm/mach-imx/imx-bbu-internal.c
+++ b/arch/arm/mach-imx/imx-bbu-internal.c
@@ -473,11 +473,9 @@ static int __register_handler(struct imx_internal_bbu_handler *imx_handler)
return ret;
}
-/*
- * Register an i.MX51 internal boot update handler for MMC/SD
- */
-int imx51_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
- unsigned long flags)
+static int
+imx_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
+ unsigned long flags, void *handler)
{
struct imx_internal_bbu_handler *imx_handler;
@@ -485,7 +483,7 @@ int imx51_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
imx_handler->flash_header_offset = FLASH_HEADER_OFFSET_MMC;
imx_handler->flags = IMX_INTERNAL_FLAG_KEEP_DOSPART;
- imx_handler->handler.handler = imx_bbu_internal_v1_update;
+ imx_handler->handler.handler = handler;
return __register_handler(imx_handler);
}
@@ -505,20 +503,24 @@ int imx51_bbu_internal_spi_i2c_register_handler(const char *name,
}
/*
- * Register an i.MX53 internal boot update handler for MMC/SD
+ * Register an i.MX51 internal boot update handler for MMC/SD
*/
-int imx53_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
+int imx51_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
unsigned long flags)
{
- struct imx_internal_bbu_handler *imx_handler;
-
- imx_handler = __init_handler(name, devicefile, flags);
- imx_handler->flash_header_offset = FLASH_HEADER_OFFSET_MMC;
- imx_handler->flags = IMX_INTERNAL_FLAG_KEEP_DOSPART;
- imx_handler->handler.handler = imx_bbu_internal_v2_update;
+ return imx_bbu_internal_mmc_register_handler(name, devicefile, flags,
+ imx_bbu_internal_v1_update);
+}
- return __register_handler(imx_handler);
+/*
+ * Register an i.MX53 internal boot update handler for MMC/SD
+ */
+int imx53_bbu_internal_mmc_register_handler(const char *name, char *devicefile,
+ unsigned long flags)
+{
+ return imx_bbu_internal_mmc_register_handler(name, devicefile, flags,
+ imx_bbu_internal_v2_update);
}
/*
--
2.17.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2018-06-12 18:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-12 18:43 [PATCH 0/6] i.MX BBU improvements and VFxxx support Andrey Smirnov
2018-06-12 18:43 ` [PATCH 1/6] ARM: i.MX: bbu: Alias identical functions Andrey Smirnov
2018-06-12 18:43 ` [PATCH 2/6] ARM: i.MX: bbu: Replace magic number with a constant Andrey Smirnov
2018-06-12 18:43 ` Andrey Smirnov [this message]
2018-06-12 18:43 ` [PATCH 4/6] ARM: i.MX: bbu: Use pr_* functions for output Andrey Smirnov
2018-06-12 18:43 ` [PATCH 5/6] ARM: i.MX: bbu: Add support for MMC on VFxxx Andrey Smirnov
2018-06-12 18:43 ` [PATCH 6/6] ARM: i.MX: zii-vf610-spu3: Add support for BBU on eMMC Andrey Smirnov
2018-06-13 7:50 ` [PATCH 0/6] i.MX BBU improvements and VFxxx 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=20180612184316.4579-5-andrew.smirnov@gmail.com \
--to=andrew.smirnov@gmail.com \
--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