1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _LIB_KSTRTOX_H 3 #define _LIB_KSTRTOX_H 4 5 #include <linux/args.h> 6 7 #define KSTRTOX_OVERFLOW (1U << 31) 8 const char *_parse_integer_fixup_radix(const char *s, unsigned int *base); 9 unsigned int _parse_integer_limit(const char *s, unsigned int base, unsigned long long *res, 10 size_t max_chars, unsigned long long init); 11 12 #define _parse_integer0(s, base, res, ...) \ 13 _parse_integer_limit(s, base, res, INT_MAX, 0) 14 15 #define _parse_integer1(s, base, res, max_chars, ...) \ 16 _parse_integer_limit(s, base, res, max_chars, 0) 17 18 #define _parse_integer2(s, base, res, max_chars, init, ...) \ 19 _parse_integer_limit(s, base, res, max_chars, init) 20 21 #define _parse_integer(s, base, res, ...) \ 22 CONCATENATE(_parse_integer, COUNT_ARGS(__VA_ARGS__))(s, base, res, __VA_ARGS__) 23 24 #endif 25