merged.

Bruce

In message: [linux-yocto][v5.10/standard/cn-sdkv4.18/cn96xx & 
v5.10/standard/cn-sdkv5.4/octeon & v5.10/standard/preempt-rt/cn-sdkv4.18/cn96xx 
& v5.10/standard/preempt-rt/cn-sdkv5.4/octeon][PATCH] include/linux/kernel.h: 
fix compile error
on 25/06/2023 Li Wang wrote:

> In file included from kernel-source/include/asm-generic/bug.h:20,
>                  from kernel-source/arch/arm64/include/asm/bug.h:26,
>                  from kernel-source/include/linux/bug.h:5,
>                  from kernel-source/include/linux/page-flags.h:10,
>                  from kernel-source/kernel/bounds.c:10:
> kernel-source/include/linux/kernel.h:361:32: error: redefinition of 'kstrtoul'
>   361 | static inline int __must_check kstrtoul(const char *s, unsigned int 
> base, unsigned long *res)
>       |                                ^~~~~~~~
> In file included from kernel-source/include/linux/kernel.h:13,
>                  from kernel-source/include/asm-generic/bug.h:20,
>                  from kernel-source/arch/arm64/include/asm/bug.h:26,
>                  from kernel-source/include/linux/bug.h:5,
>                  from kernel-source/include/linux/page-flags.h:10,
>                  from kernel-source/kernel/bounds.c:10:
> kernel-source/include/linux/kstrtox.h:30:32: note: previous definition of 
> 'kstrtoul' was here
>    30 | static inline int __must_check kstrtoul(const char *s, unsigned int 
> base, unsigned long *res)
> 
> Signed-off-by: Li Wang <li.w...@windriver.com>
> ---
>  include/linux/kernel.h | 142 -----------------------------------------
>  1 file changed, 142 deletions(-)
> 
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index 7e49841ebd45..a74a834e508d 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -336,148 +336,6 @@ int task_cleanup_handler_add(void (*handler)(struct 
> task_struct *));
>  int task_cleanup_handler_remove(void (*handler)(struct task_struct *));
>  #endif
>  
> -/* Internal, do not use. */
> -int __must_check _kstrtoul(const char *s, unsigned int base, unsigned long 
> *res);
> -int __must_check _kstrtol(const char *s, unsigned int base, long *res);
> -
> -int __must_check kstrtoull(const char *s, unsigned int base, unsigned long 
> long *res);
> -int __must_check kstrtoll(const char *s, unsigned int base, long long *res);
> -
> -/**
> - * kstrtoul - convert a string to an unsigned long
> - * @s: The start of the string. The string must be null-terminated, and may 
> also
> - *  include a single newline before its terminating null. The first character
> - *  may also be a plus sign, but not a minus sign.
> - * @base: The number base to use. The maximum supported base is 16. If base 
> is
> - *  given as 0, then the base of the string is automatically detected with 
> the
> - *  conventional semantics - If it begins with 0x the number will be parsed 
> as a
> - *  hexadecimal (case insensitive), if it otherwise begins with 0, it will be
> - *  parsed as an octal number. Otherwise it will be parsed as a decimal.
> - * @res: Where to write the result of the conversion on success.
> - *
> - * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
> - * Preferred over simple_strtoul(). Return code must be checked.
> -*/
> -static inline int __must_check kstrtoul(const char *s, unsigned int base, 
> unsigned long *res)
> -{
> -     /*
> -      * We want to shortcut function call, but
> -      * __builtin_types_compatible_p(unsigned long, unsigned long long) = 0.
> -      */
> -     if (sizeof(unsigned long) == sizeof(unsigned long long) &&
> -         __alignof__(unsigned long) == __alignof__(unsigned long long))
> -             return kstrtoull(s, base, (unsigned long long *)res);
> -     else
> -             return _kstrtoul(s, base, res);
> -}
> -
> -/**
> - * kstrtol - convert a string to a long
> - * @s: The start of the string. The string must be null-terminated, and may 
> also
> - *  include a single newline before its terminating null. The first character
> - *  may also be a plus sign or a minus sign.
> - * @base: The number base to use. The maximum supported base is 16. If base 
> is
> - *  given as 0, then the base of the string is automatically detected with 
> the
> - *  conventional semantics - If it begins with 0x the number will be parsed 
> as a
> - *  hexadecimal (case insensitive), if it otherwise begins with 0, it will be
> - *  parsed as an octal number. Otherwise it will be parsed as a decimal.
> - * @res: Where to write the result of the conversion on success.
> - *
> - * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
> - * Preferred over simple_strtol(). Return code must be checked.
> - */
> -static inline int __must_check kstrtol(const char *s, unsigned int base, 
> long *res)
> -{
> -     /*
> -      * We want to shortcut function call, but
> -      * __builtin_types_compatible_p(long, long long) = 0.
> -      */
> -     if (sizeof(long) == sizeof(long long) &&
> -         __alignof__(long) == __alignof__(long long))
> -             return kstrtoll(s, base, (long long *)res);
> -     else
> -             return _kstrtol(s, base, res);
> -}
> -
> -int __must_check kstrtouint(const char *s, unsigned int base, unsigned int 
> *res);
> -int __must_check kstrtoint(const char *s, unsigned int base, int *res);
> -
> -static inline int __must_check kstrtou64(const char *s, unsigned int base, 
> u64 *res)
> -{
> -     return kstrtoull(s, base, res);
> -}
> -
> -static inline int __must_check kstrtos64(const char *s, unsigned int base, 
> s64 *res)
> -{
> -     return kstrtoll(s, base, res);
> -}
> -
> -static inline int __must_check kstrtou32(const char *s, unsigned int base, 
> u32 *res)
> -{
> -     return kstrtouint(s, base, res);
> -}
> -
> -static inline int __must_check kstrtos32(const char *s, unsigned int base, 
> s32 *res)
> -{
> -     return kstrtoint(s, base, res);
> -}
> -
> -int __must_check kstrtou16(const char *s, unsigned int base, u16 *res);
> -int __must_check kstrtos16(const char *s, unsigned int base, s16 *res);
> -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 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);
> -int __must_check kstrtol_from_user(const char __user *s, size_t count, 
> unsigned int base, long *res);
> -int __must_check kstrtouint_from_user(const char __user *s, size_t count, 
> unsigned int base, unsigned int *res);
> -int __must_check kstrtoint_from_user(const char __user *s, size_t count, 
> unsigned int base, int *res);
> -int __must_check kstrtou16_from_user(const char __user *s, size_t count, 
> unsigned int base, u16 *res);
> -int __must_check kstrtos16_from_user(const char __user *s, size_t count, 
> unsigned int base, s16 *res);
> -int __must_check kstrtou8_from_user(const char __user *s, size_t count, 
> unsigned int base, u8 *res);
> -int __must_check kstrtos8_from_user(const char __user *s, size_t count, 
> unsigned int base, s8 *res);
> -int __must_check kstrtobool_from_user(const char __user *s, size_t count, 
> bool *res);
> -
> -static inline int __must_check kstrtou64_from_user(const char __user *s, 
> size_t count, unsigned int base, u64 *res)
> -{
> -     return kstrtoull_from_user(s, count, base, res);
> -}
> -
> -static inline int __must_check kstrtos64_from_user(const char __user *s, 
> size_t count, unsigned int base, s64 *res)
> -{
> -     return kstrtoll_from_user(s, count, base, res);
> -}
> -
> -static inline int __must_check kstrtou32_from_user(const char __user *s, 
> size_t count, unsigned int base, u32 *res)
> -{
> -     return kstrtouint_from_user(s, count, base, res);
> -}
> -
> -static inline int __must_check kstrtos32_from_user(const char __user *s, 
> size_t count, unsigned int base, s32 *res)
> -{
> -     return kstrtoint_from_user(s, count, base, res);
> -}
> -
> -/*
> - * Use kstrto<foo> instead.
> - *
> - * NOTE: simple_strto<foo> does not check for the range overflow and,
> - *    depending on the input, may give interesting results.
> - *
> - * Use these functions if and only if you cannot use kstrto<foo>, because
> - * the conversion ends on the first non-digit character, which may be far
> - * beyond the supported range. It might be useful to parse the strings like
> - * 10x50 or 12:21 without altering original string or temporary buffer in 
> use.
> - * Keep in mind above caveat.
> - */
> -
> -extern unsigned long simple_strtoul(const char *,char **,unsigned int);
> -extern long simple_strtol(const char *,char **,unsigned int);
> -extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
> -extern long long simple_strtoll(const char *,char **,unsigned int);
> -
>  extern int num_to_str(char *buf, int size,
>                     unsigned long long num, unsigned int width);
>  
> -- 
> 2.31.1
> 
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#12796): 
https://lists.yoctoproject.org/g/linux-yocto/message/12796
Mute This Topic: https://lists.yoctoproject.org/mt/99766568/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: 
https://lists.yoctoproject.org/g/linux-yocto/leave/6687884/21656/624485779/xyzzy
 [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to