diff mbox series

[v5,1/7] lib/string_helpers: Add str_read_write() helper

Message ID 20220812165243.22177-2-ddrokosov@sberdevices.ru (mailing list archive)
State Changes Requested
Headers show
Series iio: accel: add MSA311 accelerometer driver | expand

Commit Message

Dmitry Rokosov Aug. 12, 2022, 4:52 p.m. UTC
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Add str_read_write() helper to return 'read' or 'write' string literal.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
---
 include/linux/string_helpers.h | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Dmitry Rokosov Aug. 12, 2022, 5:15 p.m. UTC | #1
Hello Andy,

Please be informed, I've patched commit msg a little bit, replaced
'retun' misstyping to 'return'.

On Fri, Aug 12, 2022 at 04:52:25PM +0000, Dmitry Rokosov wrote:
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Add str_read_write() helper to return 'read' or 'write' string literal.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Dmitry Rokosov <ddrokosov@sberdevices.ru>
> ---
>  include/linux/string_helpers.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
> index 4d72258d42fd..9e22cd78f3b8 100644
> --- a/include/linux/string_helpers.h
> +++ b/include/linux/string_helpers.h
> @@ -126,4 +126,9 @@ 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
> -- 
> 2.36.0
diff mbox series

Patch

diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 4d72258d42fd..9e22cd78f3b8 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -126,4 +126,9 @@  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