Skip to content

Commit

Permalink
gpio: Convert to use match_string() helper
Browse files Browse the repository at this point in the history
The new helper returns index of the matching string in an array.
We are going to use it here.

Signed-off-by: Andy Shevchenko <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
  • Loading branch information
andy-shev authored and linusw committed May 16, 2018
1 parent 6906a4f commit 4b21f94
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/gpio/gpiolib-of.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,8 @@ static struct gpio_desc *of_find_regulator_gpio(struct device *dev, const char *
if (!con_id)
return ERR_PTR(-ENOENT);

for (i = 0; i < ARRAY_SIZE(whitelist); i++)
if (!strcmp(con_id, whitelist[i]))
break;

if (i == ARRAY_SIZE(whitelist))
i = match_string(whitelist, ARRAY_SIZE(whitelist), con_id);
if (i < 0)
return ERR_PTR(-ENOENT);

desc = of_get_named_gpiod_flags(np, con_id, 0, of_flags);
Expand Down

0 comments on commit 4b21f94

Please sign in to comment.