On Mon, Aug 20, 2018 at 11:25:45PM -0700, Andrey Smirnov wrote:
> Since imx_bbu_check_prereq() already uses file_detect_type() and we've
> extended it to understand i.MX boot image file type, we can simplify a
> bunch of repetitive code as follows:
> 
>     1. Convert all checks from IVT_BARKER to filetype_imx_image_v2
>        check
> 
>     2. Move all of the checking to be a part of imx_bbu_check_prereq()
> 
> Signed-off-by: Andrey Smirnov <andrew.smir...@gmail.com>
> ---
>  arch/arm/mach-imx/imx-bbu-internal.c | 64 +++++++++++++++++-----------
>  1 file changed, 39 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/imx-bbu-internal.c 
> b/arch/arm/mach-imx/imx-bbu-internal.c
> index 67ae2961c..ea57b2772 100644
> --- a/arch/arm/mach-imx/imx-bbu-internal.c
> +++ b/arch/arm/mach-imx/imx-bbu-internal.c
> @@ -106,11 +106,39 @@ err_close:
>       return ret;
>  }
>  
> -static int imx_bbu_check_prereq(const char *devicefile, struct bbu_data 
> *data)
> +static int imx_bbu_check_prereq(struct imx_internal_bbu_handler *imx_handler,
> +                             const char *devicefile, struct bbu_data *data,
> +                             enum filetype expected_type)
>  {
>       int ret;
> -
> -     if (file_detect_type(data->image, data->len) != filetype_arm_barebox) {
> +     const void *blob;
> +     size_t len;
> +     enum filetype type;
> +
> +     type = file_detect_type(data->image, data->len);
> +
> +     switch (type) {
> +     case filetype_arm_barebox:
> +             /*
> +              * Specifying expected_type as unknow will disable the

s/unknow/unknown/

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 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

Reply via email to