diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2015-01-11 18:45:55 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-01-14 08:21:38 -0500 |
commit | f684e4ac9f4bae4e6ecff92eef9645a44764fc04 (patch) | |
tree | 77455f29e17d3aa03e65aecdb505a850b4f10ce4 /drivers/pinctrl/pinconf-generic.c | |
parent | 7382b6231591a76d061d04a420937bbc5e1c1106 (diff) |
pinctrl: pinconf-generic: loose DT dependence
New pin controllers such as ACPI-based may also have custom properties
to parse, and should be able to use generic pin config. Let's make the
code compile on !OF systems and rename members a bit to underscore it
is custom parameters and not necessarily DT parameters.
This fixes a build regression for x86_64 on the zeroday kernel builds.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Reviewed-and-tested-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinconf-generic.c')
-rw-r--r-- | drivers/pinctrl/pinconf-generic.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c index e0886665b70a..4db92f64b4de 100644 --- a/drivers/pinctrl/pinconf-generic.c +++ b/drivers/pinctrl/pinconf-generic.c | |||
@@ -113,10 +113,11 @@ void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev, struct seq_file *s, | |||
113 | pinconf_generic_dump_one(pctldev, s, gname, pin, conf_items, | 113 | pinconf_generic_dump_one(pctldev, s, gname, pin, conf_items, |
114 | ARRAY_SIZE(conf_items)); | 114 | ARRAY_SIZE(conf_items)); |
115 | /* driver-specific parameters */ | 115 | /* driver-specific parameters */ |
116 | if (pctldev->desc->num_dt_params && pctldev->desc->conf_items) | 116 | if (pctldev->desc->num_custom_params && |
117 | pctldev->desc->custom_conf_items) | ||
117 | pinconf_generic_dump_one(pctldev, s, gname, pin, | 118 | pinconf_generic_dump_one(pctldev, s, gname, pin, |
118 | pctldev->desc->conf_items, | 119 | pctldev->desc->custom_conf_items, |
119 | pctldev->desc->num_dt_params); | 120 | pctldev->desc->num_custom_params); |
120 | } | 121 | } |
121 | 122 | ||
122 | void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, | 123 | void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, |
@@ -131,21 +132,24 @@ void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, | |||
131 | pinconf_to_config_argument(config)); | 132 | pinconf_to_config_argument(config)); |
132 | } | 133 | } |
133 | 134 | ||
134 | if (!pctldev->desc->num_dt_params || !pctldev->desc->conf_items) | 135 | if (!pctldev->desc->num_custom_params || |
136 | !pctldev->desc->custom_conf_items) | ||
135 | return; | 137 | return; |
136 | 138 | ||
137 | for (i = 0; i < pctldev->desc->num_dt_params; i++) { | 139 | for (i = 0; i < pctldev->desc->num_custom_params; i++) { |
138 | if (pinconf_to_config_param(config) != pctldev->desc->conf_items[i].param) | 140 | if (pinconf_to_config_param(config) != |
141 | pctldev->desc->custom_conf_items[i].param) | ||
139 | continue; | 142 | continue; |
140 | seq_printf(s, "%s: 0x%x", pctldev->desc->conf_items[i].display, | 143 | seq_printf(s, "%s: 0x%x", |
141 | pinconf_to_config_argument(config)); | 144 | pctldev->desc->custom_conf_items[i].display, |
145 | pinconf_to_config_argument(config)); | ||
142 | } | 146 | } |
143 | } | 147 | } |
144 | EXPORT_SYMBOL_GPL(pinconf_generic_dump_config); | 148 | EXPORT_SYMBOL_GPL(pinconf_generic_dump_config); |
145 | #endif | 149 | #endif |
146 | 150 | ||
147 | #ifdef CONFIG_OF | 151 | #ifdef CONFIG_OF |
148 | static const struct pinconf_generic_dt_params dt_params[] = { | 152 | static const struct pinconf_generic_params dt_params[] = { |
149 | { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 }, | 153 | { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 }, |
150 | { "bias-high-impedance", PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0 }, | 154 | { "bias-high-impedance", PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0 }, |
151 | { "bias-bus-hold", PIN_CONFIG_BIAS_BUS_HOLD, 0 }, | 155 | { "bias-bus-hold", PIN_CONFIG_BIAS_BUS_HOLD, 0 }, |
@@ -170,9 +174,9 @@ static const struct pinconf_generic_dt_params dt_params[] = { | |||
170 | }; | 174 | }; |
171 | 175 | ||
172 | /** | 176 | /** |
173 | * parse_dt_cfg - Parse DT pinconf parameters | 177 | * parse_dt_cfg() - Parse DT pinconf parameters |
174 | * @np: DT node | 178 | * @np: DT node |
175 | * @params: Array of describing DT parameters | 179 | * @params: Array of describing generic parameters |
176 | * @count: Number of entries in @params | 180 | * @count: Number of entries in @params |
177 | * @cfg: Array of parsed config options | 181 | * @cfg: Array of parsed config options |
178 | * @ncfg: Number of entries in @cfg | 182 | * @ncfg: Number of entries in @cfg |
@@ -183,7 +187,7 @@ static const struct pinconf_generic_dt_params dt_params[] = { | |||
183 | * needs to have enough memory allocated to hold all possible entries. | 187 | * needs to have enough memory allocated to hold all possible entries. |
184 | */ | 188 | */ |
185 | static void parse_dt_cfg(struct device_node *np, | 189 | static void parse_dt_cfg(struct device_node *np, |
186 | const struct pinconf_generic_dt_params *params, | 190 | const struct pinconf_generic_params *params, |
187 | unsigned int count, unsigned long *cfg, | 191 | unsigned int count, unsigned long *cfg, |
188 | unsigned int *ncfg) | 192 | unsigned int *ncfg) |
189 | { | 193 | { |
@@ -192,7 +196,7 @@ static void parse_dt_cfg(struct device_node *np, | |||
192 | for (i = 0; i < count; i++) { | 196 | for (i = 0; i < count; i++) { |
193 | u32 val; | 197 | u32 val; |
194 | int ret; | 198 | int ret; |
195 | const struct pinconf_generic_dt_params *par = ¶ms[i]; | 199 | const struct pinconf_generic_params *par = ¶ms[i]; |
196 | 200 | ||
197 | ret = of_property_read_u32(np, par->property, &val); | 201 | ret = of_property_read_u32(np, par->property, &val); |
198 | 202 | ||
@@ -232,15 +236,16 @@ int pinconf_generic_parse_dt_config(struct device_node *np, | |||
232 | /* allocate a temporary array big enough to hold one of each option */ | 236 | /* allocate a temporary array big enough to hold one of each option */ |
233 | max_cfg = ARRAY_SIZE(dt_params); | 237 | max_cfg = ARRAY_SIZE(dt_params); |
234 | if (pctldev) | 238 | if (pctldev) |
235 | max_cfg += pctldev->desc->num_dt_params; | 239 | max_cfg += pctldev->desc->num_custom_params; |
236 | cfg = kcalloc(max_cfg, sizeof(*cfg), GFP_KERNEL); | 240 | cfg = kcalloc(max_cfg, sizeof(*cfg), GFP_KERNEL); |
237 | if (!cfg) | 241 | if (!cfg) |
238 | return -ENOMEM; | 242 | return -ENOMEM; |
239 | 243 | ||
240 | parse_dt_cfg(np, dt_params, ARRAY_SIZE(dt_params), cfg, &ncfg); | 244 | parse_dt_cfg(np, dt_params, ARRAY_SIZE(dt_params), cfg, &ncfg); |
241 | if (pctldev && pctldev->desc->num_dt_params && pctldev->desc->params) | 245 | if (pctldev && pctldev->desc->num_custom_params && |
242 | parse_dt_cfg(np, pctldev->desc->params, | 246 | pctldev->desc->custom_params) |
243 | pctldev->desc->num_dt_params, cfg, &ncfg); | 247 | parse_dt_cfg(np, pctldev->desc->custom_params, |
248 | pctldev->desc->num_custom_params, cfg, &ncfg); | ||
244 | 249 | ||
245 | ret = 0; | 250 | ret = 0; |
246 | 251 | ||