aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorEldad Zack <eldad@fogrefinery.com>2012-12-17 19:03:04 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-17 20:15:22 -0500
commit4c925d6031f719fad6ea8b1c94a636f4c0fea39b (patch)
treea27265311ff47951ab00d4df3b49350c1ae898ba /include/linux/kernel.h
parent543f56c19c3e926d33b50a6bcbc37c408631601e (diff)
kstrto*: add documentation
As Bruce Fields pointed out, kstrto* is currently lacking kerneldoc comments. This patch adds kerneldoc comments to common variants of kstrto*: kstrto(u)l, kstrto(u)ll and kstrto(u)int. Signed-off-by: Eldad Zack <eldad@fogrefinery.com> Cc: J. Bruce Fields <bfields@fieldses.org> Cc: Joe Perches <joe@perches.com> Cc: Randy Dunlap <rdunlap@xenotime.net> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Rob Landley <rob@landley.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index d97ed5897447..d140e8fb075f 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -220,6 +220,23 @@ int __must_check _kstrtol(const char *s, unsigned int base, long *res);
220 220
221int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res); 221int __must_check kstrtoull(const char *s, unsigned int base, unsigned long long *res);
222int __must_check kstrtoll(const char *s, unsigned int base, long long *res); 222int __must_check kstrtoll(const char *s, unsigned int base, long long *res);
223
224/**
225 * kstrtoul - convert a string to an unsigned long
226 * @s: The start of the string. The string must be null-terminated, and may also
227 * include a single newline before its terminating null. The first character
228 * may also be a plus sign, but not a minus sign.
229 * @base: The number base to use. The maximum supported base is 16. If base is
230 * given as 0, then the base of the string is automatically detected with the
231 * conventional semantics - If it begins with 0x the number will be parsed as a
232 * hexadecimal (case insensitive), if it otherwise begins with 0, it will be
233 * parsed as an octal number. Otherwise it will be parsed as a decimal.
234 * @res: Where to write the result of the conversion on success.
235 *
236 * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
237 * Used as a replacement for the obsolete simple_strtoull. Return code must
238 * be checked.
239*/
223static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res) 240static inline int __must_check kstrtoul(const char *s, unsigned int base, unsigned long *res)
224{ 241{
225 /* 242 /*
@@ -233,6 +250,22 @@ static inline int __must_check kstrtoul(const char *s, unsigned int base, unsign
233 return _kstrtoul(s, base, res); 250 return _kstrtoul(s, base, res);
234} 251}
235 252
253/**
254 * kstrtol - convert a string to a long
255 * @s: The start of the string. The string must be null-terminated, and may also
256 * include a single newline before its terminating null. The first character
257 * may also be a plus sign or a minus sign.
258 * @base: The number base to use. The maximum supported base is 16. If base is
259 * given as 0, then the base of the string is automatically detected with the
260 * conventional semantics - If it begins with 0x the number will be parsed as a
261 * hexadecimal (case insensitive), if it otherwise begins with 0, it will be
262 * parsed as an octal number. Otherwise it will be parsed as a decimal.
263 * @res: Where to write the result of the conversion on success.
264 *
265 * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.
266 * Used as a replacement for the obsolete simple_strtoull. Return code must
267 * be checked.
268 */
236static inline int __must_check kstrtol(const char *s, unsigned int base, long *res) 269static inline int __must_check kstrtol(const char *s, unsigned int base, long *res)
237{ 270{
238 /* 271 /*