Skip to content

Commit 32cebfe

Browse files
Hongbo Liakpm00
authored andcommitted
lib/string_choices: add str_true_false()/str_false_true() helper
Add str_true_false()/str_false_true() helper to retur a "true" or "false" string literal. We found more than 10 cases currently exist in the tree. So these helpers can be used for these cases. This patch (of 3): Add str_true_false()/str_false_true() helper to return "true" or "false" string literal. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Hongbo Li <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Anna Schumaker <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Kees Cook <[email protected]> Cc: Matthew Wilcox <[email protected]> Cc: Trond Myklebust <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent e16c7b0 commit 32cebfe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/linux/string_choices.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ static inline const char *str_yes_no(bool v)
4242
return v ? "yes" : "no";
4343
}
4444

45+
static inline const char *str_true_false(bool v)
46+
{
47+
return v ? "true" : "false";
48+
}
49+
#define str_false_true(v) str_true_false(!(v))
50+
4551
/**
4652
* str_plural - Return the simple pluralization based on English counts
4753
* @num: Number used for deciding pluralization

0 commit comments

Comments
 (0)