From: Joe Perches <joe@perches.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Cai Huoqing <caihuoqing@baidu.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
Vadim Pasternak <vadimp@mellanox.com>
Cc: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>,
Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>,
Doug Ledford <dledford@redhat.com>,
Jason Gunthorpe <jgg@ziepe.ca>
Subject: Re: [PATCH v2 1/1] infiniband: hf1: Use string_upper() instead of open coded variant
Date: Fri, 01 Oct 2021 06:31:21 -0700 [thread overview]
Message-ID: <256e577b57eb21555de96846d1ac4cfa3b8ee238.camel@perches.com> (raw)
In-Reply-To: <20211001123153.67379-1-andriy.shevchenko@linux.intel.com>
On Fri, 2021-10-01 at 15:31 +0300, Andy Shevchenko wrote:
> Use string_upper() from string helper module instead of open coded variant.
Perhaps these string_upper and string_lower utility functions
should return dst not void so these functions could be used in
output calls.
So instead of:
+ string_upper(prefix_name, prefix_name);
snprintf(name, sizeof(name), "%s-%s", prefix_name, kind);
this could be consolidated:
snprintf(name, sizeof(name), "%s-%s", string_upper(prefix_name), kind);
Perhaps:
---
include/linux/string_helpers.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/include/linux/string_helpers.h b/include/linux/string_helpers.h
index 68189c4a2eb11..ef92a9471f2a9 100644
--- a/include/linux/string_helpers.h
+++ b/include/linux/string_helpers.h
@@ -81,18 +81,26 @@ 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)
+static inline char *string_upper(char *dst, const char *src)
{
+ char *rtn = dst;
+
do {
*dst++ = toupper(*src);
} while (*src++);
+
+ return rtn;
}
-static inline void string_lower(char *dst, const char *src)
+static inline char *string_lower(char *dst, const char *src)
{
+ char *rtn = dst;
+
do {
*dst++ = tolower(*src);
} while (*src++);
+
+ return rtn;
}
char *kstrdup_quotable(const char *src, gfp_t gfp);
next prev parent reply other threads:[~2021-10-01 13:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-01 12:31 Andy Shevchenko
2021-10-01 13:31 ` Joe Perches [this message]
2021-10-01 13:48 ` Andy Shevchenko
2021-10-05 18:23 ` Jason Gunthorpe
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=256e577b57eb21555de96846d1ac4cfa3b8ee238.camel@perches.com \
--to=joe@perches.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=caihuoqing@baidu.com \
--cc=dennis.dalessandro@cornelisnetworks.com \
--cc=dledford@redhat.com \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mike.marciniszyn@cornelisnetworks.com \
--cc=vadimp@mellanox.com \
/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®