Skip to content

Commit a9fc766

Browse files
committed
lib/string_choices: Add str_high_low() helper
Add str_high_low() helper to return 'high' or 'low' string literal. Also add an inversed variant, i.e. str_low_high(). All the same for str_hi_low(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
1 parent fca7607 commit a9fc766

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

include/linux/string_choices.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,18 @@ static inline const char *str_enabled_disabled(bool v)
1414
return v ? "enabled" : "disabled";
1515
}
1616

17+
static inline const char *str_hi_lo(bool v)
18+
{
19+
return v ? "hi" : "lo";
20+
}
21+
#define str_lo_hi(v) str_hi_lo(!(v))
22+
23+
static inline const char *str_high_low(bool v)
24+
{
25+
return v ? "high" : "low";
26+
}
27+
#define str_low_high(v) str_high_low(!(v))
28+
1729
static inline const char *str_read_write(bool v)
1830
{
1931
return v ? "read" : "write";

0 commit comments

Comments
 (0)