diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2016-03-17 17:22:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-17 18:09:34 -0400 |
commit | dff4359448126936bf9b341ad7a1a7b6e0b6e95b (patch) | |
tree | 4471b1359b626eefd97026dbc96a60f0931d021d /drivers/pinctrl/pinmux.c | |
parent | a7c1d0a987ee3be0b87db5c95aa4fbadf7c3c1c2 (diff) |
pinctrl: convert to use match_string() helper
The new helper returns index of the mathing string in an array. We
would use it here.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pinctrl/pinmux.c')
-rw-r--r-- | drivers/pinctrl/pinmux.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c index 29984b36926a..c223a9ef1fe1 100644 --- a/drivers/pinctrl/pinmux.c +++ b/drivers/pinctrl/pinmux.c | |||
@@ -334,7 +334,6 @@ int pinmux_map_to_setting(struct pinctrl_map const *map, | |||
334 | unsigned num_groups; | 334 | unsigned num_groups; |
335 | int ret; | 335 | int ret; |
336 | const char *group; | 336 | const char *group; |
337 | int i; | ||
338 | 337 | ||
339 | if (!pmxops) { | 338 | if (!pmxops) { |
340 | dev_err(pctldev->dev, "does not support mux function\n"); | 339 | dev_err(pctldev->dev, "does not support mux function\n"); |
@@ -363,19 +362,13 @@ int pinmux_map_to_setting(struct pinctrl_map const *map, | |||
363 | return -EINVAL; | 362 | return -EINVAL; |
364 | } | 363 | } |
365 | if (map->data.mux.group) { | 364 | if (map->data.mux.group) { |
366 | bool found = false; | ||
367 | group = map->data.mux.group; | 365 | group = map->data.mux.group; |
368 | for (i = 0; i < num_groups; i++) { | 366 | ret = match_string(groups, num_groups, group); |
369 | if (!strcmp(group, groups[i])) { | 367 | if (ret < 0) { |
370 | found = true; | ||
371 | break; | ||
372 | } | ||
373 | } | ||
374 | if (!found) { | ||
375 | dev_err(pctldev->dev, | 368 | dev_err(pctldev->dev, |
376 | "invalid group \"%s\" for function \"%s\"\n", | 369 | "invalid group \"%s\" for function \"%s\"\n", |
377 | group, map->data.mux.function); | 370 | group, map->data.mux.function); |
378 | return -EINVAL; | 371 | return ret; |
379 | } | 372 | } |
380 | } else { | 373 | } else { |
381 | group = groups[0]; | 374 | group = groups[0]; |