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 /include | |
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 'include')
-rw-r--r-- | include/linux/pinctrl/pinctrl.h | 6 | ||||
-rw-r--r-- | include/linux/pinctrl/pinmux.h | 7 |
2 files changed, 5 insertions, 8 deletions
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h index aa92cdeb99fd..c22d0409d2ef 100644 --- a/include/linux/pinctrl/pinctrl.h +++ b/include/linux/pinctrl/pinctrl.h | |||
@@ -66,9 +66,7 @@ struct pinctrl_gpio_range { | |||
66 | /** | 66 | /** |
67 | * struct pinctrl_ops - global pin control operations, to be implemented by | 67 | * struct pinctrl_ops - global pin control operations, to be implemented by |
68 | * pin controller drivers. | 68 | * pin controller drivers. |
69 | * @list_groups: list the number of selectable named groups available | 69 | * @get_groups_count: Returns the count of total number of groups registered. |
70 | * in this pinmux driver, the core will begin on 0 and call this | ||
71 | * repeatedly as long as it returns >= 0 to enumerate the groups | ||
72 | * @get_group_name: return the group name of the pin group | 70 | * @get_group_name: return the group name of the pin group |
73 | * @get_group_pins: return an array of pins corresponding to a certain | 71 | * @get_group_pins: return an array of pins corresponding to a certain |
74 | * group selector @pins, and the size of the array in @num_pins | 72 | * group selector @pins, and the size of the array in @num_pins |
@@ -76,7 +74,7 @@ struct pinctrl_gpio_range { | |||
76 | * info for a certain pin in debugfs | 74 | * info for a certain pin in debugfs |
77 | */ | 75 | */ |
78 | struct pinctrl_ops { | 76 | struct pinctrl_ops { |
79 | int (*list_groups) (struct pinctrl_dev *pctldev, unsigned selector); | 77 | int (*get_groups_count) (struct pinctrl_dev *pctldev); |
80 | const char *(*get_group_name) (struct pinctrl_dev *pctldev, | 78 | const char *(*get_group_name) (struct pinctrl_dev *pctldev, |
81 | unsigned selector); | 79 | unsigned selector); |
82 | int (*get_group_pins) (struct pinctrl_dev *pctldev, | 80 | int (*get_group_pins) (struct pinctrl_dev *pctldev, |
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h index 47e9237edd47..dd7bef61d066 100644 --- a/include/linux/pinctrl/pinmux.h +++ b/include/linux/pinctrl/pinmux.h | |||
@@ -29,9 +29,8 @@ struct pinctrl_dev; | |||
29 | * is allowed to answer "no" by returning a negative error code | 29 | * is allowed to answer "no" by returning a negative error code |
30 | * @free: the reverse function of the request() callback, frees a pin after | 30 | * @free: the reverse function of the request() callback, frees a pin after |
31 | * being requested | 31 | * being requested |
32 | * @list_functions: list the number of selectable named functions available | 32 | * @get_functions_count: returns number of selectable named functions available |
33 | * in this pinmux driver, the core will begin on 0 and call this | 33 | * in this pinmux driver |
34 | * repeatedly as long as it returns >= 0 to enumerate mux settings | ||
35 | * @get_function_name: return the function name of the muxing selector, | 34 | * @get_function_name: return the function name of the muxing selector, |
36 | * called by the core to figure out which mux setting it shall map a | 35 | * called by the core to figure out which mux setting it shall map a |
37 | * certain device to | 36 | * certain device to |
@@ -62,7 +61,7 @@ struct pinctrl_dev; | |||
62 | struct pinmux_ops { | 61 | struct pinmux_ops { |
63 | int (*request) (struct pinctrl_dev *pctldev, unsigned offset); | 62 | int (*request) (struct pinctrl_dev *pctldev, unsigned offset); |
64 | int (*free) (struct pinctrl_dev *pctldev, unsigned offset); | 63 | int (*free) (struct pinctrl_dev *pctldev, unsigned offset); |
65 | int (*list_functions) (struct pinctrl_dev *pctldev, unsigned selector); | 64 | int (*get_functions_count) (struct pinctrl_dev *pctldev); |
66 | const char *(*get_function_name) (struct pinctrl_dev *pctldev, | 65 | const char *(*get_function_name) (struct pinctrl_dev *pctldev, |
67 | unsigned selector); | 66 | unsigned selector); |
68 | int (*get_function_groups) (struct pinctrl_dev *pctldev, | 67 | int (*get_function_groups) (struct pinctrl_dev *pctldev, |