OpenWrt – Blame information for rev 2
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | From 09240ae27ffca65518f7b9d2360c020c1b1ddabe Mon Sep 17 00:00:00 2001 |
2 | From: Linus Walleij <linus.walleij@linaro.org> |
||
3 | Date: Sat, 28 Oct 2017 15:37:18 +0200 |
||
4 | Subject: [PATCH 05/31] pinctrl: gemini: Use generic DT parser |
||
5 | |||
6 | We can just use the generic Device Tree parser code |
||
7 | in this driver and save some code. |
||
8 | |||
9 | Acked-by: Hans Ulli Kroll <ulli.kroll@googlemail.com> |
||
10 | Signed-off-by: Linus Walleij <linus.walleij@linaro.org> |
||
11 | --- |
||
12 | drivers/pinctrl/Kconfig | 1 + |
||
13 | drivers/pinctrl/pinctrl-gemini.c | 66 +++------------------------------------- |
||
14 | 2 files changed, 5 insertions(+), 62 deletions(-) |
||
15 | |||
16 | --- a/drivers/pinctrl/Kconfig |
||
17 | +++ b/drivers/pinctrl/Kconfig |
||
18 | @@ -153,6 +153,7 @@ config PINCTRL_GEMINI |
||
19 | depends on ARCH_GEMINI |
||
20 | default ARCH_GEMINI |
||
21 | select PINMUX |
||
22 | + select GENERIC_PINCONF |
||
23 | select MFD_SYSCON |
||
24 | |||
25 | config PINCTRL_MCP23S08 |
||
26 | --- a/drivers/pinctrl/pinctrl-gemini.c |
||
27 | +++ b/drivers/pinctrl/pinctrl-gemini.c |
||
28 | @@ -13,6 +13,8 @@ |
||
29 | #include <linux/pinctrl/machine.h> |
||
30 | #include <linux/pinctrl/pinctrl.h> |
||
31 | #include <linux/pinctrl/pinmux.h> |
||
32 | +#include <linux/pinctrl/pinconf.h> |
||
33 | +#include <linux/pinctrl/pinconf-generic.h> |
||
34 | #include <linux/platform_device.h> |
||
35 | #include <linux/slab.h> |
||
36 | #include <linux/regmap.h> |
||
37 | @@ -1918,73 +1920,13 @@ static void gemini_pin_dbg_show(struct p |
||
38 | seq_printf(s, " " DRIVER_NAME); |
||
39 | } |
||
40 | |||
41 | -static int gemini_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, |
||
42 | - struct device_node *np, |
||
43 | - struct pinctrl_map **map, |
||
44 | - unsigned int *reserved_maps, |
||
45 | - unsigned int *num_maps) |
||
46 | -{ |
||
47 | - int ret; |
||
48 | - const char *function = NULL; |
||
49 | - const char *group; |
||
50 | - struct property *prop; |
||
51 | - |
||
52 | - ret = of_property_read_string(np, "function", &function); |
||
53 | - if (ret < 0) |
||
54 | - return ret; |
||
55 | - |
||
56 | - ret = of_property_count_strings(np, "groups"); |
||
57 | - if (ret < 0) |
||
58 | - return ret; |
||
59 | - |
||
60 | - ret = pinctrl_utils_reserve_map(pctldev, map, reserved_maps, |
||
61 | - num_maps, ret); |
||
62 | - if (ret < 0) |
||
63 | - return ret; |
||
64 | - |
||
65 | - of_property_for_each_string(np, "groups", prop, group) { |
||
66 | - ret = pinctrl_utils_add_map_mux(pctldev, map, reserved_maps, |
||
67 | - num_maps, group, function); |
||
68 | - if (ret < 0) |
||
69 | - return ret; |
||
70 | - pr_debug("ADDED FUNCTION %s <-> GROUP %s\n", |
||
71 | - function, group); |
||
72 | - } |
||
73 | - |
||
74 | - return 0; |
||
75 | -} |
||
76 | - |
||
77 | -static int gemini_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, |
||
78 | - struct device_node *np_config, |
||
79 | - struct pinctrl_map **map, |
||
80 | - unsigned int *num_maps) |
||
81 | -{ |
||
82 | - unsigned int reserved_maps = 0; |
||
83 | - struct device_node *np; |
||
84 | - int ret; |
||
85 | - |
||
86 | - *map = NULL; |
||
87 | - *num_maps = 0; |
||
88 | - |
||
89 | - for_each_child_of_node(np_config, np) { |
||
90 | - ret = gemini_pinctrl_dt_subnode_to_map(pctldev, np, map, |
||
91 | - &reserved_maps, num_maps); |
||
92 | - if (ret < 0) { |
||
93 | - pinctrl_utils_free_map(pctldev, *map, *num_maps); |
||
94 | - return ret; |
||
95 | - } |
||
96 | - } |
||
97 | - |
||
98 | - return 0; |
||
99 | -}; |
||
100 | - |
||
101 | static const struct pinctrl_ops gemini_pctrl_ops = { |
||
102 | .get_groups_count = gemini_get_groups_count, |
||
103 | .get_group_name = gemini_get_group_name, |
||
104 | .get_group_pins = gemini_get_group_pins, |
||
105 | .pin_dbg_show = gemini_pin_dbg_show, |
||
106 | - .dt_node_to_map = gemini_pinctrl_dt_node_to_map, |
||
107 | - .dt_free_map = pinctrl_utils_free_map, |
||
108 | + .dt_node_to_map = pinconf_generic_dt_node_to_map_group, |
||
109 | + .dt_free_map = pinconf_generic_dt_free_map, |
||
110 | }; |
||
111 | |||
112 | /** |