From: Andy Shevchenko Date: Thu, 3 May 2018 17:14:46 +0000 (+0300) Subject: gpio: Convert to use match_string() helper X-Git-Tag: v4.19~849^2~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b21f94a3001ba5326425d6b6d93bc63ddebdc97;p=platform%2Fkernel%2Flinux-rpi.git gpio: Convert to use match_string() helper The new helper returns index of the matching string in an array. We are going to use it here. Signed-off-by: Andy Shevchenko Signed-off-by: Linus Walleij --- diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 586d15137c03..28d968088131 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -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);