All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] infiniband: hf1: Use string_upper() instead of open coded variant
@ 2021-05-18 12:41 Andy Shevchenko
  2021-05-20 15:27 ` Jason Gunthorpe
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2021-05-18 12:41 UTC (permalink / raw)
  To: Andy Shevchenko, linux-rdma, linux-kernel
  Cc: Mike Marciniszyn, Dennis Dalessandro, Doug Ledford, Jason Gunthorpe

Use string_upper() from string helper module instead of open coded variant.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/infiniband/hw/hfi1/efivar.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/efivar.c b/drivers/infiniband/hw/hfi1/efivar.c
index c22ab7b5163b..197cbd620662 100644
--- a/drivers/infiniband/hw/hfi1/efivar.c
+++ b/drivers/infiniband/hw/hfi1/efivar.c
@@ -45,7 +45,8 @@
  *
  */
 
-#include <linux/ctype.h>
+#include <linux/string_helpers.h>
+
 #include "efivar.h"
 
 /* GUID for HFI1 variables in EFI */
@@ -154,7 +155,6 @@ int read_hfi1_efi_var(struct hfi1_devdata *dd, const char *kind,
 	char prefix_name[64];
 	char name[64];
 	int result;
-	int i;
 
 	/* create a common prefix */
 	snprintf(prefix_name, sizeof(prefix_name), "%04x:%02x:%02x.%x",
@@ -170,10 +170,7 @@ int read_hfi1_efi_var(struct hfi1_devdata *dd, const char *kind,
 	 * variable.
 	 */
 	if (result) {
-		/* Converting to uppercase */
-		for (i = 0; prefix_name[i]; i++)
-			if (isalpha(prefix_name[i]))
-				prefix_name[i] = toupper(prefix_name[i]);
+		string_upper(prefix_name, prefix_name);
 		snprintf(name, sizeof(name), "%s-%s", prefix_name, kind);
 		result = read_efi_var(name, size, return_data);
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] infiniband: hf1: Use string_upper() instead of open coded variant
  2021-05-18 12:41 [PATCH v1 1/1] infiniband: hf1: Use string_upper() instead of open coded variant Andy Shevchenko
@ 2021-05-20 15:27 ` Jason Gunthorpe
  0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2021-05-20 15:27 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-rdma, linux-kernel, Mike Marciniszyn, Dennis Dalessandro,
	Doug Ledford

On Tue, May 18, 2021 at 03:41:11PM +0300, Andy Shevchenko wrote:
> Use string_upper() from string helper module instead of open coded variant.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/infiniband/hw/hfi1/efivar.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)

It doesn't compile??

In file included from drivers/infiniband/hw/hfi1/efivar.c:48:
./include/linux/string_helpers.h: In function ‘string_escape_str’:
./include/linux/string_helpers.h:70:32: error: implicit declaration of function ‘strlen’ [-Werror=implicit-function-declaration]
   70 |  return string_escape_mem(src, strlen(src), dst, sz, flags, only);
      |                                ^~~~~~
./include/linux/string_helpers.h:70:32: warning: incompatible implicit declaration of built-in function ‘strlen’
./include/linux/string_helpers.h:6:1: note: include ‘<string.h>’ or provide a declaration of ‘strlen’
    5 | #include <linux/ctype.h>
  +++ |+#include <string.h>
    6 | #include <linux/types.h>
cc1: some warnings being treated as errors

Jason

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-05-20 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 12:41 [PATCH v1 1/1] infiniband: hf1: Use string_upper() instead of open coded variant Andy Shevchenko
2021-05-20 15:27 ` Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.