summaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinmux.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pinctrl/pinmux.c')
-rw-r--r--drivers/pinctrl/pinmux.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index 4e62783a573a..375b214780e9 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -33,10 +33,11 @@
33int pinmux_check_ops(struct pinctrl_dev *pctldev) 33int pinmux_check_ops(struct pinctrl_dev *pctldev)
34{ 34{
35 const struct pinmux_ops *ops = pctldev->desc->pmxops; 35 const struct pinmux_ops *ops = pctldev->desc->pmxops;
36 unsigned nfuncs = ops->get_functions_count(pctldev);
36 unsigned selector = 0; 37 unsigned selector = 0;
37 38
38 /* Check that we implement required operations */ 39 /* Check that we implement required operations */
39 if (!ops->list_functions || 40 if (!ops->get_functions_count ||
40 !ops->get_function_name || 41 !ops->get_function_name ||
41 !ops->get_function_groups || 42 !ops->get_function_groups ||
42 !ops->enable || 43 !ops->enable ||
@@ -44,7 +45,7 @@ int pinmux_check_ops(struct pinctrl_dev *pctldev)
44 return -EINVAL; 45 return -EINVAL;
45 46
46 /* Check that all functions registered have names */ 47 /* Check that all functions registered have names */
47 while (ops->list_functions(pctldev, selector) >= 0) { 48 while (selector < nfuncs) {
48 const char *fname = ops->get_function_name(pctldev, 49 const char *fname = ops->get_function_name(pctldev,
49 selector); 50 selector);
50 if (!fname) { 51 if (!fname) {
@@ -287,10 +288,11 @@ static int pinmux_func_name_to_selector(struct pinctrl_dev *pctldev,
287 const char *function) 288 const char *function)
288{ 289{
289 const struct pinmux_ops *ops = pctldev->desc->pmxops; 290 const struct pinmux_ops *ops = pctldev->desc->pmxops;
291 unsigned nfuncs = ops->get_functions_count(pctldev);
290 unsigned selector = 0; 292 unsigned selector = 0;
291 293
292 /* See if this pctldev has this function */ 294 /* See if this pctldev has this function */
293 while (ops->list_functions(pctldev, selector) >= 0) { 295 while (selector < nfuncs) {
294 const char *fname = ops->get_function_name(pctldev, 296 const char *fname = ops->get_function_name(pctldev,
295 selector); 297 selector);
296 298
@@ -477,11 +479,12 @@ static int pinmux_functions_show(struct seq_file *s, void *what)
477{ 479{
478 struct pinctrl_dev *pctldev = s->private; 480 struct pinctrl_dev *pctldev = s->private;
479 const struct pinmux_ops *pmxops = pctldev->desc->pmxops; 481 const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
482 unsigned nfuncs = pmxops->get_functions_count(pctldev);
480 unsigned func_selector = 0; 483 unsigned func_selector = 0;
481 484
482 mutex_lock(&pinctrl_mutex); 485 mutex_lock(&pinctrl_mutex);
483 486
484 while (pmxops->list_functions(pctldev, func_selector) >= 0) { 487 while (func_selector < nfuncs) {
485 const char *func = pmxops->get_function_name(pctldev, 488 const char *func = pmxops->get_function_name(pctldev,
486 func_selector); 489 func_selector);
487 const char * const *groups; 490 const char * const *groups;