Merge tag 'dm-pull-26jul22' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm.git
[platform/kernel/u-boot.git] / cmd / lzmadec.c
index c78df82..81924da 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2013 Patrice Bouchand <pbfwdlist_gmail_com>
  * lzma uncompress command in Uboot
@@ -6,18 +7,18 @@
  *
  * (C) Copyright 2000
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
 #include <mapmem.h>
 #include <asm/io.h>
 
 #include <lzma/LzmaTools.h>
 
-static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_lzmadec(struct cmd_tbl *cmdtp, int flag, int argc,
+                     char *const argv[])
 {
        unsigned long src, dst;
        SizeT src_len = ~0UL, dst_len = ~0UL;
@@ -25,11 +26,11 @@ static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
 
        switch (argc) {
        case 4:
-               dst_len = simple_strtoul(argv[3], NULL, 16);
+               dst_len = hextoul(argv[3], NULL);
                /* fall through */
        case 3:
-               src = simple_strtoul(argv[1], NULL, 16);
-               dst = simple_strtoul(argv[2], NULL, 16);
+               src = hextoul(argv[1], NULL);
+               dst = hextoul(argv[2], NULL);
                break;
        default:
                return CMD_RET_USAGE;
@@ -42,7 +43,7 @@ static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                return 1;
        printf("Uncompressed size: %ld = %#lX\n", (ulong)src_len,
               (ulong)src_len);
-       setenv_hex("filesize", src_len);
+       env_set_hex("filesize", src_len);
 
        return 0;
 }