lib/string_helpers: Split out string_choices.h
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 6 Mar 2023 19:55:42 +0000 (21:55 +0200)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 12 Jun 2023 17:14:21 +0000 (20:14 +0300)
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>
MAINTAINERS
include/linux/string_choices.h [new file with mode: 0644]
include/linux/string_helpers.h

index 44a413a..781be51 100644 (file)
@@ -8672,6 +8672,7 @@ GENERIC STRING LIBRARY
 R:     Andy Shevchenko <andy@kernel.org>
 S:     Maintained
 F:     include/linux/string.h
+F:     include/linux/string_choices.h
 F:     include/linux/string_helpers.h
 F:     lib/string.c
 F:     lib/string_helpers.c
diff --git a/include/linux/string_choices.h b/include/linux/string_choices.h
new file mode 100644 (file)
index 0000000..b7e7b9f
--- /dev/null
@@ -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
index fae6bea..789ab30 100644 (file)
@@ -4,6 +4,7 @@
 
 #include <linux/bits.h>
 #include <linux/ctype.h>
+#include <linux/string_choices.h>
 #include <linux/string.h>
 #include <linux/types.h>
 
@@ -113,29 +114,4 @@ void kfree_strarray(char **array, size_t n);
 
 char **devm_kasprintf_strarray(struct device *dev, const char *prefix, size_t n);
 
-static inline const char *str_yes_no(bool v)
-{
-       return v ? "yes" : "no";
-}
-
-static inline const char *str_on_off(bool v)
-{
-       return v ? "on" : "off";
-}
-
-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";
-}
-
 #endif