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@xxxxxxxxx> --- 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@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox