lib/string_choices: Add str_true_false()/str_false_true() helper
PATCH v2 1/1 lib/string_choices: Add str_true_false()/str_false_true() helper
Add str_true_false()/str_false_true() helper to return "true" or "false" string literal.
---
v2:
- Squash into a single patch as Andy Shevchenko' suggesstion.
v1:
- https://lore.kernel.org/all/[email protected]/T/
--- include/linux/string_choices.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/linux/string_choices.h +6 -0
@@ -48,6 +48,12 @@ static inline const char *str_up_down(bool v) }#define str_down_up (v) str_up_down(!(v)) +static inline const char *str_true_false (bool v) +{ +return v ?"true" :"false" ; +} +#define str_false_true (v) str_true_false(!(v)) +/** * str_plural - Return the simple pluralization based on English counts * @num: Number used for deciding pluralization
Signature · 1 line
2.34.1
As discussed in the previous thread, the coccinelle rules and some replacements will be added in the future.
Thanks,
Hongbo
Quoted 32 lines · Hongbo Li
Add str_true_false()/str_false_true() helper to return "true" or "false" string literal.
Signed-off-by Hongbo Li <[email protected]>---
v2:
- Squash into a single patch as Andy Shevchenko' suggesstion.v1:
- https://lore.kernel.org/all/[email protected]/T/--- include/linux/string_choices.h | 6 ++++++ 1 file changed, 6 insertions(+)include/linux/string_choices.h +6
-0@@ -48,6 +48,12 @@ static inline const char *str_up_down(bool v) }#define str_down_up (v) str_up_down(!(v)) +static inline const char *str_true_false (bool v) +{ +return v ?"true" :"false" ; +} +#define str_false_true (v) str_true_false(!(v)) +/** * str_plural - Return the simple pluralization based on English counts * @num: Number used for deciding pluralization
Quoted 2 lines · Hongbo Li
As discussed in the previous thread, the coccinelle rules and some replacements will be added in the future.
Then we have to wait for this one until then. Remember, we can not take functions that no one calls, as they will be noticed and someone will remove them.
Please make a patch series with the function being used, that's the only way we can actually determine if the addition is correct or not.
thanks,
greg k-h