Skip to content

Commit

Permalink
IB/hf1: Use string_upper() instead of an open coded variant
Browse files Browse the repository at this point in the history
Use string_upper() from the string helper module instead of an	open coded
variant.

Link: https://lore.kernel.org/r/20211001123153.67379-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
  • Loading branch information
Andy Shevchenko authored and Jason Gunthorpe committed Oct 5, 2021
1 parent 8e913a8 commit 286dba6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions drivers/infiniband/hw/hfi1/efivar.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
* Copyright(c) 2015, 2016 Intel Corporation.
*/

#include <linux/ctype.h>
#include <linux/string.h>
#include <linux/string_helpers.h>

#include "efivar.h"

/* GUID for HFI1 variables in EFI */
Expand Down Expand Up @@ -112,7 +114,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",
Expand All @@ -128,10 +129,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);
}
Expand Down

0 comments on commit 286dba6

Please sign in to comment.