kstrto*: correct documentation references to simple_strto*()
PATCH 1/2 kstrto*: correct documentation references to simple_strto*()
The documentation of the kstrto*() functions reference the simple_strtoull function by "used as a replacement for [the obsolete] simple_strtoull". All these functions describes themselves as replacements for the function simple_strtoull, even though a function like kstrtol() would be more aptly described as a replacement of simple_strtol().
Fix these references by making the documentation of kstrto*() reference the closest simple_strto*() equivalent available. The functions kstrto[u]int() do not have direct simple_strto[u]int() equivalences, so these are made to refer to simple_strto[u]l() instead.
Furthermore, add parentheses after function names, as is standard in kernel documentation.
--- include/linux/kernel.h | 4 ++-- lib/kstrtox.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)
include/linux/kernel.h +2 -2
@@ -346,7 +346,7 @@ int __must_check kstrtoll(const char *s, unsigned int base, long long *res);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the simple_strtoull. Return code must be checked. +* Used as a replacement for the simple_strtoul(). Return code must be checked. */ static inline int __must_check kstrtoul (const char *s,unsigned int base,unsigned long *res) {
@@ -374,7 +374,7 @@ static inline int __must_check kstrtoul(const char *s, unsigned int base, unsign* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the simple_strtoull. Return code must be checked. +* Used as a replacement for the simple_strtol(). Return code must be checked. */ static inline int __must_check kstrtol (const char *s,unsigned int base,long *res) {
lib/kstrtox.c +4 -4
@@ -115,7 +115,7 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoull. Return code must +* Used as a replacement for the obsolete simple_strtoull(). Return code must * be checked. */ int kstrtoull (const char *s,unsigned int base,unsigned long long *res)
@@ -139,7 +139,7 @@ EXPORT_SYMBOL(kstrtoull);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoull. Return code must +* Used as a replacement for the obsolete simple_strtoll(). Return code must * be checked. */ int kstrtoll (const char *s,unsigned int base,long long *res)
@@ -211,7 +211,7 @@ EXPORT_SYMBOL(_kstrtol);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoull. Return code must +* Used as a replacement for the obsolete simple_strtoul(). Return code must * be checked. */ int kstrtouint (const char *s,unsigned int base,unsigned int *res)
@@ -242,7 +242,7 @@ EXPORT_SYMBOL(kstrtouint);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoull. Return code must +* Used as a replacement for the obsolete simple_strtol(). Return code must * be checked. */ int kstrtoint (const char *s,unsigned int base,int *res)
Signature · 1 line
2.28.0
PATCH 2/2 kstrto*: do not describe simple_strto*() as obsolete/replaced
The documentation of the kstrto*() functions describes kstrto*() as "replacements" of the "obsolete" simple_strto*() functions. Both of these terms are inaccurate: they're not replacements because they have different behaviour, and the simple_strto*() are not obsolete because there are cases where they have benefits over kstrto*().
Remove usage of the terms "replacement" and "obsolete" in reference to simple_strto*(), and instead use the term "preferred over".
--- include/linux/kernel.h | 4 ++-- lib/kstrtox.c | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-)
include/linux/kernel.h +2 -2
@@ -346,7 +346,7 @@ int __must_check kstrtoll(const char *s, unsigned int base, long long *res);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the simple_strtoul(). Return code must be checked. +* Preferred over simple_strtoul(). Return code must be checked. */ static inline int __must_check kstrtoul (const char *s,unsigned int base,unsigned long *res) {
@@ -374,7 +374,7 @@ static inline int __must_check kstrtoul(const char *s, unsigned int base, unsign* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the simple_strtol(). Return code must be checked. +* Preferred over simple_strtol(). Return code must be checked. */ static inline int __must_check kstrtol (const char *s,unsigned int base,long *res) {
lib/kstrtox.c +4 -8
@@ -115,8 +115,7 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoull(). Return code must -* be checked. +* Preferred over simple_strtoull(). Return code must be checked. */ int kstrtoull (const char *s,unsigned int base,unsigned long long *res) {
@@ -139,8 +138,7 @@ EXPORT_SYMBOL(kstrtoull);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoll(). Return code must -* be checked. +* Preferred over simple_strtoll(). Return code must be checked. */ int kstrtoll (const char *s,unsigned int base,long long *res) {
@@ -211,8 +209,7 @@ EXPORT_SYMBOL(_kstrtol);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoul(). Return code must -* be checked. +* Preferred over simple_strtoul(). Return code must be checked. */ int kstrtouint (const char *s,unsigned int base,unsigned int *res) {
@@ -242,8 +239,7 @@ EXPORT_SYMBOL(kstrtouint);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtol(). Return code must -* be checked. +* Preferred over simple_strtol(). Return code must be checked. */ int kstrtoint (const char *s,unsigned int base,int *res) {
Signature · 1 line
2.28.0
Re: [PATCH 2/2] kstrto*: do not describe simple_strto*() as obsolete/replaced
Quoted 8 lines · Kars Mulder
The documentation of the kstrto*() functions describes kstrto*() as "replacements" of the "obsolete" simple_strto*() functions. Both of these terms are inaccurate: they're not replacements because they have different behaviour, and the simple_strto*() are not obsolete because there are cases where they have benefits over kstrto*().
Remove usage of the terms "replacement" and "obsolete" in reference to simple_strto*(), and instead use the term "preferred over".
Quoted 78 lines
Fixes 4c925d6031f71 ("kstrto*: add documentation")Fixes 885e68e8b7b13 ("kernel.h: update comment about simple_strto<foo>() functions")Signed-off-by Kars Mulder <[email protected]>--- include/linux/kernel.h | 4 ++-- lib/kstrtox.c | 12 ++++-------- 2 files changed, 6 insertions(+), 10 deletions(-)include/linux/kernel.h +2
-2@@ -346,7 +346,7 @@ int __must_check kstrtoll(const char *s, unsigned int base, long long *res);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the simple_strtoul(). Return code must be checked. +* Preferred over simple_strtoul(). Return code must be checked. */ static inline int __must_check kstrtoul (const char *s,unsigned int base,unsigned long *res) {@@ -374,7 +374,7 @@ static inline int __must_check kstrtoul(const char *s, unsigned int base, unsign* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the simple_strtol(). Return code must be checked. +* Preferred over simple_strtol(). Return code must be checked. */ static inline int __must_check kstrtol (const char *s,unsigned int base,long *res) {lib/kstrtox.c +4
-9@@ -115,8 +115,7 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoull(). Return code must -* be checked. +* Preferred over simple_strtoull(). Return code must be checked. */ int kstrtoull (const char *s,unsigned int base,unsigned long long *res) {@@ -139,8 +138,7 @@ EXPORT_SYMBOL(kstrtoull);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoll(). Return code must -* be checked. +* Preferred over simple_strtoll(). Return code must be checked. */ int kstrtoll (const char *s,unsigned int base,long long *res) {@@ -211,8 +209,7 @@ EXPORT_SYMBOL(_kstrtol);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoul(). Return code must -* be checked. +* Preferred over simple_strtoul(). Return code must be checked. */ int kstrtouint (const char *s,unsigned int base,unsigned int *res) {@@ -242,8 +239,7 @@ EXPORT_SYMBOL(kstrtouint);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtol(). Return code must -* be checked. +* Preferred over simple_strtol(). Return code must be checked. */ int kstrtoint (const char *s,unsigned int base,int *res) { --2.28.0
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 6 lines · Kars Mulder
The documentation of the kstrto*() functions reference the
simple_strtoullfunction by "used as a replacement for [the obsolete]simple_strtoull". All these functions describes themselves as replacements for the functionsimple_strtoull, even though a function likekstrtol()would be more aptly described as a replacement ofsimple_strtol().
Quoted 7 lines
Fix these references by making the documentation of kstrto*() reference the closest simple_strto*() equivalent available. The functions kstrto[u]int() do not have direct simple_strto[u]int() equivalences, so these are made to refer to simple_strto[u]l() instead.
Furthermore, add parentheses after function names, as is standard in kernel documentation.
Quoted 73 lines
Fixes 4c925d6031f71 ("kstrto*: add documentation")Signed-off-by Kars Mulder <[email protected]>--- include/linux/kernel.h | 4 ++-- lib/kstrtox.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-)include/linux/kernel.h +2
-2@@ -346,7 +346,7 @@ int __must_check kstrtoll(const char *s, unsigned int base, long long *res);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the simple_strtoull. Return code must be checked. +* Used as a replacement for the simple_strtoul(). Return code must be checked. */ static inline int __must_check kstrtoul (const char *s,unsigned int base,unsigned long *res) {@@ -374,7 +374,7 @@ static inline int __must_check kstrtoul(const char *s, unsigned int base, unsign* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the simple_strtoull. Return code must be checked. +* Used as a replacement for the simple_strtol(). Return code must be checked. */ static inline int __must_check kstrtol (const char *s,unsigned int base,long *res) {lib/kstrtox.c +4
-5@@ -115,7 +115,7 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoull. Return code must +* Used as a replacement for the obsolete simple_strtoull(). Return code must * be checked. */ int kstrtoull (const char *s,unsigned int base,unsigned long long *res)@@ -139,7 +139,7 @@ EXPORT_SYMBOL(kstrtoull);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoull. Return code must +* Used as a replacement for the obsolete simple_strtoll(). Return code must * be checked. */ int kstrtoll (const char *s,unsigned int base,long long *res)@@ -211,7 +211,7 @@ EXPORT_SYMBOL(_kstrtol);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoull. Return code must +* Used as a replacement for the obsolete simple_strtoul(). Return code must * be checked. */ int kstrtouint (const char *s,unsigned int base,unsigned int *res)@@ -242,7 +242,7 @@ EXPORT_SYMBOL(kstrtouint);* @res: Where to write the result of the conversion on success. * * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error. -* Used as a replacement for the obsolete simple_strtoull. Return code must +* Used as a replacement for the obsolete simple_strtol(). Return code must * be checked. */ int kstrtoint (const char *s,unsigned int base,int *res) --2.28.0
Signature · 2 lines
With Best Regards, Andy Shevchenko