summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRodrigo Alencar <rodrigo.alencar@analog.com>2026-06-04 10:58:59 +0100
committerJonathan Cameron <jic23@kernel.org>2026-06-30 00:15:52 +0100
commitb659b963206a9976a5ccc52a4b2aee1f674289cf (patch)
tree00af831d17318662683fa265377eedb01d830880 /include
parent1eafa5eb97dcb6a76947ffc06c18c272f1eaf1b6 (diff)
downloadlinux-b659b963206a9976a5ccc52a4b2aee1f674289cf.tar.gz
linux-b659b963206a9976a5ccc52a4b2aee1f674289cf.zip
lib: kstrtox: add kstrtoudec64() and kstrtodec64()
Add helpers that parses decimal numbers into 64-bit number, i.e., decimal point numbers with pre-defined scale are parsed into a 64-bit value (fixed precision). After the decimal point, digits beyond the specified scale are ignored. Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/kstrtox.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/kstrtox.h b/include/linux/kstrtox.h
index 6c9282866770..b41b9736886f 100644
--- a/include/linux/kstrtox.h
+++ b/include/linux/kstrtox.h
@@ -97,6 +97,9 @@ int __must_check kstrtou8(const char *s, unsigned int base, u8 *res);
int __must_check kstrtos8(const char *s, unsigned int base, s8 *res);
int __must_check kstrtobool(const char *s, bool *res);
+int __must_check kstrtoudec64(const char *s, unsigned int scale, u64 *res);
+int __must_check kstrtodec64(const char *s, unsigned int scale, s64 *res);
+
int __must_check kstrtoull_from_user(const char __user *s, size_t count, unsigned int base, unsigned long long *res);
int __must_check kstrtoll_from_user(const char __user *s, size_t count, unsigned int base, long long *res);
int __must_check kstrtoul_from_user(const char __user *s, size_t count, unsigned int base, unsigned long *res);