Re: [PATCH v8 02/10] lib: kstrtox: add kstrntoull() helper

From: David Laight

Date: Wed Mar 04 2026 - 05:17:29 EST


On Tue, 03 Mar 2026 13:27:07 +0000
Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@xxxxxxxxxx> wrote:

> From: Rodrigo Alencar <rodrigo.alencar@xxxxxxxxxx>
>
> Add kstrntoull() function, which converts a string to an ULL with a max
> character limit. The function is an alternative integer parsing function
> that does not require a null-terminated string. It becomes a better option
> over simple_strtoull() or kstrtoull() when parsing integers from a buffer
> with custom delimiters without having to create temporary copies.
> The function is consumed inside the implementation _kstrtoull(),
> promoting reuse.

If you've got custom delimiters use a function that returns a pointer
to the character that terminated the conversion.
They save you having to find the delimiter as well as taking a copy.

David