diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2023-03-06 22:55:42 +0300 |
---|---|---|
committer | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2023-06-12 20:14:21 +0300 |
commit | fca76071bab2304b379c35674d3b9e36a82e364a (patch) | |
tree | 4a2404804a55fc24ff3b09bc222e031aad76f5c3 /include/linux/string_choices.h | |
parent | 27896ffd8fe41a6f052962c2fb1573daa6476f13 (diff) | |
download | linux-fca76071bab2304b379c35674d3b9e36a82e364a.tar.xz |
lib/string_helpers: Split out string_choices.h
Some users may only need the string choice APIs. Split
the respective header, i.e. string_choices.h. Include
it in the string_helpers.h for backward compatibility.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'include/linux/string_choices.h')
-rw-r--r-- | include/linux/string_choices.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h new file mode 100644 index 000000000000..b7e7b9fd098c --- /dev/null +++ b/include/linux/string_choices.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_STRING_CHOICES_H_ +#define _LINUX_STRING_CHOICES_H_ + +#include <linux/types.h> + +static inline const char *str_enable_disable(bool v) +{ + return v ? "enable" : "disable"; +} + +static inline const char *str_enabled_disabled(bool v) +{ + return v ? "enabled" : "disabled"; +} + +static inline const char *str_read_write(bool v) +{ + return v ? "read" : "write"; +} + +static inline const char *str_on_off(bool v) +{ + return v ? "on" : "off"; +} + +static inline const char *str_yes_no(bool v) +{ + return v ? "yes" : "no"; +} + +#endif |