imx: ahab: allow to bypass confirmation for ahab_close cmd
authorClément Péron <peron.clem@gmail.com>
Mon, 21 Dec 2020 17:31:28 +0000 (18:31 +0100)
committerStefano Babic <sbabic@denx.de>
Sat, 26 Dec 2020 13:56:09 +0000 (14:56 +0100)
Calling ahab_close cmd force the user to interact for confirmation.

This is not user-friendly when using this cmd during factory process.

Allow the user to pass '-y' option to bypass this confirmation.

Signed-off-by: Clément Péron <peron.clem@gmail.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Acked-by: Oliver Graute <oliver.graute@kococonnector.com>
arch/arm/mach-imx/imx8/ahab.c

index 4bb7c46..600a110 100644 (file)
@@ -303,10 +303,11 @@ static int confirm_close(void)
 static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc,
                         char *const argv[])
 {
+       int confirmed = argc >= 2 && !strcmp(argv[1], "-y");
        int err;
        u16 lc;
 
-       if (!confirm_close())
+       if (!confirmed && !confirm_close())
                return -EACCES;
 
        err = sc_seco_chip_info(-1, &lc, NULL, NULL, NULL);