mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vadim Pasternak <vadimp@mellanox.com>
To: andy@infradead.org, dvhart@infradead.org
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Vadim Pasternak <vadimp@mellanox.com>
Subject: [PATCH platform-next v2 01/11] lib/string_helpers: Introduce string_upper() and string_lower() helpers
Date: Tue, 14 Jul 2020 15:01:53 +0300	[thread overview]
Message-ID: <20200714120203.10352-2-vadimp@mellanox.com> (raw)
In-Reply-To: <20200714120203.10352-1-vadimp@mellanox.com>

Provide the helpers for string conversions to upper alnd lower cases.

Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
---
 include/linux/string_helpers.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index c28955132234..86f150c2a6b6 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -2,6 +2,7 @@
 #ifndef _LINUX_STRING_HELPERS_H_
 #define _LINUX_STRING_HELPERS_H_
 
+#include <linux/ctype.h>
 #include <linux/types.h>
 
 struct file;
@@ -75,6 +76,20 @@ static inline int string_escape_str_any_np(const char *src, char *dst,
 	return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, only);
 }
 
+static inline void string_upper(char *dst, const char *src)
+{
+	do {
+		*dst++ = toupper(*src);
+	} while (*src++);
+}
+
+static inline void string_lower(char *dst, const char *src)
+{
+	do {
+		*dst++ = tolower(*src);
+	} while (*src++);
+}
+
 char *kstrdup_quotable(const char *src, gfp_t gfp);
 char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp);
 char *kstrdup_quotable_file(struct file *file, gfp_t gfp);
-- 
2.11.0


  reply	other threads:[~2020-07-14 12:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 12:01 [PATCH platform-next v2 00/11] platform/x86: Add new features for Mellanox systems Vadim Pasternak
2020-07-14 12:01 ` Vadim Pasternak [this message]
2020-07-14 12:01 ` [PATCH platform-next v2 02/11] lib/test-string_helpers.c: Add string_upper() and string_lower() tests Vadim Pasternak
2020-07-14 12:01 ` [PATCH platform-next v2 03/11] platform/mellanox: mlxreg-hotplug: Modify module license Vadim Pasternak
2020-07-14 12:01 ` [PATCH platform-next v2 04/11] platform/mellanox: mlxreg-hotplug: Use capability register for attribute creation Vadim Pasternak
2020-07-14 12:01 ` [PATCH platform-next v2 05/11] platform/mellanox: mlxreg-hotplug: Add environmental data to uevent Vadim Pasternak
2020-07-14 12:01 ` [PATCH platform-next v2 06/11] platform_data/mlxreg: Add support for complex attributes Vadim Pasternak
2020-07-14 12:01 ` [PATCH platform-next v2 07/11] platform/x86: mlx-platform: Add more definitions for system attributes Vadim Pasternak
2020-07-14 12:02 ` [PATCH platform-next v2 08/11] platform/mellanox: mlxreg-io: Add support for complex attributes Vadim Pasternak
2020-07-14 12:02 ` [PATCH platform-next v2 09/11] Documentation/ABI: Add new attribute for mlxreg-io sysfs interfaces Vadim Pasternak
2020-07-14 12:02 ` [PATCH platform-next v2 10/11] platform_data/mlxreg: Add presence register field for FAN devices Vadim Pasternak
2020-07-14 12:02 ` [PATCH platform-next v2 11/11] platform/x86: mlx-platform: Extend FAN platform data description Vadim Pasternak
2020-07-15 10:01 ` [PATCH platform-next v2 00/11] platform/x86: Add new features for Mellanox systems Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200714120203.10352-2-vadimp@mellanox.com \
    --to=vadimp@mellanox.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®