Re: [PATCH] lib/string_choices: add str_pass_fail() and str_passed_failed()
From: Andy Shevchenko
Date: Wed Aug 19 2026 - 13:11:24 EST
On Wed, Aug 19, 2026 at 5:35 PM Dmitry Antipov <dmantipov@xxxxxxxxx> wrote:
>
> Looking over a few kernel subsystems I'm currently working on,
> I suppose that 'str_pass_fail()' and 'str_passed_failed()' with
> their opposite counterpart macros may be useful as well.
But we don't take this without users. So, at least convert one
existing case per the API (so, +2 patches).
...
> }
> #define str_off_on(v) str_on_off(!(v))
^^^
> +static inline const char *str_pass_fail(bool v)
> +{
> + return v ? "pass" : "fail";
> +}
> +
> +#define str_fail_pass(v) str_pass_fail(!(v))
As you may easily see, the style is to avoid the blank line in each of
the group of helpers (static inline + #define are coupled).
> +
> +static inline const char *str_passed_failed(bool v)
> +{
> + return v ? "passed" : "failed";
> +}
> +
> +#define str_failed_passed(v) str_passed_failed(!(v))
Ditto.
--
With Best Regards,
Andy Shevchenko