Re: [PATCH v11 02/11] lib: kstrtox: add kstrtoudec64() and kstrtodec64()

From: Randy Dunlap

Date: Wed May 06 2026 - 16:07:24 EST




On 5/6/26 7:08 AM, Rodrigo Alencar via B4 Relay wrote:
> +/**
> + * kstrtoudec64 - convert a string to an unsigned 64-bit decimal number
> + * @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. Digits beyond the specified
> + * scale are ignored.
> + * @scale: The number of digits to the right of the decimal point. For example,
> + * a scale of 2 would mean the number is represented with two decimal places,
> + * so "123.45" would be represented as 12345.
> + * @res: Where to write the result of the conversion on success.
> + *
> + * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.

Use
* Return:
or
* Returns:
please.

> + */
> +noinline
> +int kstrtoudec64(const char *s, unsigned int scale, u64 *res)
> +{
> + if (s[0] == '+')
> + s++;
> + return _kstrtoudec64(s, scale, res);
> +}
> +EXPORT_SYMBOL(kstrtoudec64);
> +
> +/**
> + * kstrtodec64 - convert a string to a signed 64-bit decimal number
> + * @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. Digits beyond the specified
> + * scale are ignored.
> + * @scale: The number of digits to the right of the decimal point. For example,
> + * a scale of 5 would mean the number is represented with five decimal places,
> + * so "-3.141592" would be represented as -314159.
> + * @res: Where to write the result of the conversion on success.
> + *
> + * Returns 0 on success, -ERANGE on overflow and -EINVAL on parsing error.

Same here.

> + */
> +noinline
> +int kstrtodec64(const char *s, unsigned int scale, s64 *res)
> +{

--
~Randy