summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2015-04-27 07:42:05 +0200
committerJagan Teki <jteki@openedev.com>2015-06-30 00:40:11 +0530
commit09c3280754f8f68a4d7fc0ee397a92b38c4f59e4 (patch)
tree689e7996e2475d0199f9b16dc66009457dd66b6a /lib
parent9fe6d8716e090f3b2dd3f4604acfced124b8a2fc (diff)
downloadu-boot-09c3280754f8f68a4d7fc0ee397a92b38c4f59e4.tar.gz
u-boot-09c3280754f8f68a4d7fc0ee397a92b38c4f59e4.tar.bz2
u-boot-09c3280754f8f68a4d7fc0ee397a92b38c4f59e4.zip
mtd, nand: Move common functions from cmd_nand.c to common place
Move common functions from cmd_nand.c (for calculating offset and size from cmdline paramter) to common place, so they could used from other commands which use mtd partitions. For onenand the arg_off_size() is left in common/cmd_onenand.c. It should use now the common arg_off() function, but as I could not test onenand I let it there ... Signed-off-by: Heiko Schocher <hs@denx.de> Acked-by: Scott Wood <scottwood@freescale.com> Reviewed-by: Jagannadh Teki <jteki@openedev.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/vsprintf.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index bedc865240..a9b8a3ae67 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -909,3 +909,19 @@ void print_grouped_ull(unsigned long long int_val, int digits)
grab = 3;
}
}
+
+bool str2off(const char *p, loff_t *num)
+{
+ char *endptr;
+
+ *num = simple_strtoull(p, &endptr, 16);
+ return *p != '\0' && *endptr == '\0';
+}
+
+bool str2long(const char *p, ulong *num)
+{
+ char *endptr;
+
+ *num = simple_strtoul(p, &endptr, 16);
+ return *p != '\0' && *endptr == '\0';
+}