aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pinctrl/pinctrl-pxa3xx.c
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@st.com>2012-03-30 01:55:40 -0400
committerLinus Walleij <linus.walleij@linaro.org>2012-04-18 07:53:10 -0400
commitd1e90e9e7467dbfe521b25ba79f520bf676ebc36 (patch)
tree2c4a2b8bfa2a984cb57a781b034a204a12fcc4b6 /drivers/pinctrl/pinctrl-pxa3xx.c
parent122dbe7e58c7d064a17eefd33205227e6bce85ca (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/pinctrl-pxa3xx.c')
-rw-r--r--drivers/pinctrl/pinctrl-pxa3xx.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.c b/drivers/pinctrl/pinctrl-pxa3xx.c
index 079dce0e93e9..7644e42ac211 100644
--- a/drivers/pinctrl/pinctrl-pxa3xx.c
+++ b/drivers/pinctrl/pinctrl-pxa3xx.c
@@ -25,20 +25,18 @@ static struct pinctrl_gpio_range pxa3xx_pinctrl_gpio_range = {
25 .pin_base = 0, 25 .pin_base = 0,
26}; 26};
27 27
28static int pxa3xx_list_groups(struct pinctrl_dev *pctrldev, unsigned selector) 28static int pxa3xx_get_groups_count(struct pinctrl_dev *pctrldev)
29{ 29{
30 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); 30 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
31 if (selector >= info->num_grps) 31
32 return -EINVAL; 32 return info->num_grps;
33 return 0;
34} 33}
35 34
36static const char *pxa3xx_get_group_name(struct pinctrl_dev *pctrldev, 35static const char *pxa3xx_get_group_name(struct pinctrl_dev *pctrldev,
37 unsigned selector) 36 unsigned selector)
38{ 37{
39 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); 38 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
40 if (selector >= info->num_grps) 39
41 return NULL;
42 return info->grps[selector].name; 40 return info->grps[selector].name;
43} 41}
44 42
@@ -48,25 +46,23 @@ static int pxa3xx_get_group_pins(struct pinctrl_dev *pctrldev,
48 unsigned *num_pins) 46 unsigned *num_pins)
49{ 47{
50 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); 48 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
51 if (selector >= info->num_grps) 49
52 return -EINVAL;
53 *pins = info->grps[selector].pins; 50 *pins = info->grps[selector].pins;
54 *num_pins = info->grps[selector].npins; 51 *num_pins = info->grps[selector].npins;
55 return 0; 52 return 0;
56} 53}
57 54
58static struct pinctrl_ops pxa3xx_pctrl_ops = { 55static struct pinctrl_ops pxa3xx_pctrl_ops = {
59 .list_groups = pxa3xx_list_groups, 56 .get_groups_count = pxa3xx_get_groups_count,
60 .get_group_name = pxa3xx_get_group_name, 57 .get_group_name = pxa3xx_get_group_name,
61 .get_group_pins = pxa3xx_get_group_pins, 58 .get_group_pins = pxa3xx_get_group_pins,
62}; 59};
63 60
64static int pxa3xx_pmx_list_func(struct pinctrl_dev *pctrldev, unsigned func) 61static int pxa3xx_pmx_get_funcs_count(struct pinctrl_dev *pctrldev)
65{ 62{
66 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev); 63 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
67 if (func >= info->num_funcs) 64
68 return -EINVAL; 65 return info->num_funcs;
69 return 0;
70} 66}
71 67
72static const char *pxa3xx_pmx_get_func_name(struct pinctrl_dev *pctrldev, 68static const char *pxa3xx_pmx_get_func_name(struct pinctrl_dev *pctrldev,
@@ -170,7 +166,7 @@ static int pxa3xx_pmx_request_gpio(struct pinctrl_dev *pctrldev,
170} 166}
171 167
172static struct pinmux_ops pxa3xx_pmx_ops = { 168static struct pinmux_ops pxa3xx_pmx_ops = {
173 .list_functions = pxa3xx_pmx_list_func, 169 .get_functions_count = pxa3xx_pmx_get_funcs_count,
174 .get_function_name = pxa3xx_pmx_get_func_name, 170 .get_function_name = pxa3xx_pmx_get_func_name,
175 .get_function_groups = pxa3xx_pmx_get_groups, 171 .get_function_groups = pxa3xx_pmx_get_groups,
176 .enable = pxa3xx_pmx_enable, 172 .enable = pxa3xx_pmx_enable,