mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Cc: J. Bruce Fields <[email protected]> Cc: Joe Perches <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Alexey Dobriyan <[email protected]> Cc: Rob Landley <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
543f56c19c
commit
4c925d6031
3 changed files with 100 additions and 0 deletions
|
|
@ -104,6 +104,22 @@ static int _kstrtoull(const char *s, unsigned int base, unsigned long long *res)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* kstrtoull - convert a string to an unsigned long 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.
|
||||
* 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)
|
||||
{
|
||||
if (s[0] == '+')
|
||||
|
|
@ -112,6 +128,22 @@ int kstrtoull(const char *s, unsigned int base, unsigned long long *res)
|
|||
}
|
||||
EXPORT_SYMBOL(kstrtoull);
|
||||
|
||||
/**
|
||||
* kstrtoll - convert a string to a long 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.
|
||||
* Used as a replacement for the obsolete simple_strtoull. Return code must
|
||||
* be checked.
|
||||
*/
|
||||
int kstrtoll(const char *s, unsigned int base, long long *res)
|
||||
{
|
||||
unsigned long long tmp;
|
||||
|
|
@ -168,6 +200,22 @@ int _kstrtol(const char *s, unsigned int base, long *res)
|
|||
}
|
||||
EXPORT_SYMBOL(_kstrtol);
|
||||
|
||||
/**
|
||||
* kstrtouint - convert a string to an unsigned int
|
||||
* @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.
|
||||
* Used as a replacement for the obsolete simple_strtoull. Return code must
|
||||
* be checked.
|
||||
*/
|
||||
int kstrtouint(const char *s, unsigned int base, unsigned int *res)
|
||||
{
|
||||
unsigned long long tmp;
|
||||
|
|
@ -183,6 +231,22 @@ int kstrtouint(const char *s, unsigned int base, unsigned int *res)
|
|||
}
|
||||
EXPORT_SYMBOL(kstrtouint);
|
||||
|
||||
/**
|
||||
* kstrtoint - convert a string to an int
|
||||
* @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.
|
||||
* Used as a replacement for the obsolete simple_strtoull. Return code must
|
||||
* be checked.
|
||||
*/
|
||||
int kstrtoint(const char *s, unsigned int base, int *res)
|
||||
{
|
||||
long long tmp;
|
||||
|
|
|
|||
Loading…
Reference in a new issue