diff options
author | Viresh Kumar <viresh.kumar@st.com> | 2012-03-30 01:55:40 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-04-18 07:53:10 -0400 |
commit | d1e90e9e7467dbfe521b25ba79f520bf676ebc36 (patch) | |
tree | 2c4a2b8bfa2a984cb57a781b034a204a12fcc4b6 /drivers/pinctrl/pinconf.c | |
parent | 122dbe7e58c7d064a17eefd33205227e6bce85ca (diff) |
pinctrl: replace list_*() with get_*_count()
Most of the SoC drivers implement list_groups() and list_functions()
routines for pinctrl and pinmux. These routines continue returning
zero until the selector argument is greater than total count of
available groups or functions.
This patch replaces these list_*() routines with get_*_count()
routines, which returns the number of available selection for SoC
driver. pinctrl layer will use this value to check the range it can
choose.
This patch fixes all user drivers for this change. There are other
routines in user drivers, which have checks to check validity of
selector passed to them. It is also no more required and hence
removed.
Documentation updated as well.
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
[Folded in fix and fixed a minor merge artifact manually]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinconf.c')
-rw-r--r-- | drivers/pinctrl/pinconf.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c index 7321e8601294..eb3a14f4b866 100644 --- a/drivers/pinctrl/pinconf.c +++ b/drivers/pinctrl/pinconf.c | |||
@@ -495,6 +495,7 @@ static int pinconf_groups_show(struct seq_file *s, void *what) | |||
495 | struct pinctrl_dev *pctldev = s->private; | 495 | struct pinctrl_dev *pctldev = s->private; |
496 | const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; | 496 | const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; |
497 | const struct pinconf_ops *ops = pctldev->desc->confops; | 497 | const struct pinconf_ops *ops = pctldev->desc->confops; |
498 | unsigned ngroups = pctlops->get_groups_count(pctldev); | ||
498 | unsigned selector = 0; | 499 | unsigned selector = 0; |
499 | 500 | ||
500 | if (!ops || !ops->pin_config_group_get) | 501 | if (!ops || !ops->pin_config_group_get) |
@@ -505,7 +506,7 @@ static int pinconf_groups_show(struct seq_file *s, void *what) | |||
505 | 506 | ||
506 | mutex_lock(&pinctrl_mutex); | 507 | mutex_lock(&pinctrl_mutex); |
507 | 508 | ||
508 | while (pctlops->list_groups(pctldev, selector) >= 0) { | 509 | while (selector < ngroups) { |
509 | const char *gname = pctlops->get_group_name(pctldev, selector); | 510 | const char *gname = pctlops->get_group_name(pctldev, selector); |
510 | 511 | ||
511 | seq_printf(s, "%u (%s):", selector, gname); | 512 | seq_printf(s, "%u (%s):", selector, gname); |