Re: [PATCH] Use existing helper to convert "on/off" to boolean

From: Andrew Morton
Date: Fri Apr 29 2016 - 17:21:15 EST


On Fri, 29 Apr 2016 13:47:04 +0800 Minfei Huang <mnghuan@xxxxxxxxx> wrote:

> It's more convenient to use existing function helper to convert string
> "on/off" to boolean.
>
> ...
>
> --- a/lib/kstrtox.c
> +++ b/lib/kstrtox.c
> @@ -326,7 +326,7 @@ EXPORT_SYMBOL(kstrtos8);
> * @s: input string
> * @res: result
> *
> - * This routine returns 0 iff the first character is one of 'Yy1Nn0', or
> + * This routine returns 0 if the first character is one of 'Yy1Nn0', or

That isn't actually a typo. "iff" is shorthand for "if and only if".
ie: kstrtobool() will not return 0 in any other case.

Use of "iff" is a bit pretentious but I guess it does convey some
conceivably useful info.