diff options
author | Beniamino Galvani <b.galvani@gmail.com> | 2014-07-07 17:40:47 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-08-05 13:02:54 -0400 |
commit | 34e0247ffcae3228684668a6244a7308b78571c7 (patch) | |
tree | 6fba4deafcd1be4605870531068a6fedbf3cd176 | |
parent | 0b8eebc02a26500ad5084e421793eb15b41bb08e (diff) |
regulator: act8865: fix build when OF is not enabled
act8846_matches and act8865_matches are defined only when OF is
enabled. Move references to them to the act8865_pdata_from_dt()
function to avoid a build error when OF is disabled.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Beniamino Galvani <b.galvani@gmail.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | drivers/regulator/act8865-regulator.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c index a5ad69a0aca9..afd06f92dfdf 100644 --- a/drivers/regulator/act8865-regulator.c +++ b/drivers/regulator/act8865-regulator.c | |||
@@ -198,12 +198,12 @@ static struct of_regulator_match act8865_matches[] = { | |||
198 | static int act8865_pdata_from_dt(struct device *dev, | 198 | static int act8865_pdata_from_dt(struct device *dev, |
199 | struct device_node **of_node, | 199 | struct device_node **of_node, |
200 | struct act8865_platform_data *pdata, | 200 | struct act8865_platform_data *pdata, |
201 | struct of_regulator_match *matches, | 201 | unsigned long type) |
202 | int num_matches) | ||
203 | { | 202 | { |
204 | int matched, i; | 203 | int matched, i, num_matches; |
205 | struct device_node *np; | 204 | struct device_node *np; |
206 | struct act8865_regulator_data *regulator; | 205 | struct act8865_regulator_data *regulator; |
206 | struct of_regulator_match *matches; | ||
207 | 207 | ||
208 | np = of_get_child_by_name(dev->of_node, "regulators"); | 208 | np = of_get_child_by_name(dev->of_node, "regulators"); |
209 | if (!np) { | 209 | if (!np) { |
@@ -211,6 +211,20 @@ static int act8865_pdata_from_dt(struct device *dev, | |||
211 | return -EINVAL; | 211 | return -EINVAL; |
212 | } | 212 | } |
213 | 213 | ||
214 | switch (type) { | ||
215 | case ACT8846: | ||
216 | matches = act8846_matches; | ||
217 | num_matches = ARRAY_SIZE(act8846_matches); | ||
218 | break; | ||
219 | case ACT8865: | ||
220 | matches = act8865_matches; | ||
221 | num_matches = ARRAY_SIZE(act8865_matches); | ||
222 | break; | ||
223 | default: | ||
224 | dev_err(dev, "invalid device id %lu\n", type); | ||
225 | return -EINVAL; | ||
226 | } | ||
227 | |||
214 | matched = of_regulator_match(dev, np, matches, num_matches); | 228 | matched = of_regulator_match(dev, np, matches, num_matches); |
215 | of_node_put(np); | 229 | of_node_put(np); |
216 | if (matched <= 0) | 230 | if (matched <= 0) |
@@ -238,7 +252,8 @@ static int act8865_pdata_from_dt(struct device *dev, | |||
238 | #else | 252 | #else |
239 | static inline int act8865_pdata_from_dt(struct device *dev, | 253 | static inline int act8865_pdata_from_dt(struct device *dev, |
240 | struct device_node **of_node, | 254 | struct device_node **of_node, |
241 | struct act8865_platform_data *pdata) | 255 | struct act8865_platform_data *pdata, |
256 | unsigned long type) | ||
242 | { | 257 | { |
243 | return 0; | 258 | return 0; |
244 | } | 259 | } |
@@ -265,7 +280,6 @@ static int act8865_pmic_probe(struct i2c_client *client, | |||
265 | { | 280 | { |
266 | static const struct regulator_desc *regulators; | 281 | static const struct regulator_desc *regulators; |
267 | struct act8865_platform_data pdata_of, *pdata; | 282 | struct act8865_platform_data pdata_of, *pdata; |
268 | struct of_regulator_match *matches; | ||
269 | struct device *dev = &client->dev; | 283 | struct device *dev = &client->dev; |
270 | struct device_node **of_node; | 284 | struct device_node **of_node; |
271 | int i, ret, num_regulators; | 285 | int i, ret, num_regulators; |
@@ -288,12 +302,10 @@ static int act8865_pmic_probe(struct i2c_client *client, | |||
288 | 302 | ||
289 | switch (type) { | 303 | switch (type) { |
290 | case ACT8846: | 304 | case ACT8846: |
291 | matches = act8846_matches; | ||
292 | regulators = act8846_regulators; | 305 | regulators = act8846_regulators; |
293 | num_regulators = ARRAY_SIZE(act8846_regulators); | 306 | num_regulators = ARRAY_SIZE(act8846_regulators); |
294 | break; | 307 | break; |
295 | case ACT8865: | 308 | case ACT8865: |
296 | matches = act8865_matches; | ||
297 | regulators = act8865_regulators; | 309 | regulators = act8865_regulators; |
298 | num_regulators = ARRAY_SIZE(act8865_regulators); | 310 | num_regulators = ARRAY_SIZE(act8865_regulators); |
299 | break; | 311 | break; |
@@ -308,8 +320,7 @@ static int act8865_pmic_probe(struct i2c_client *client, | |||
308 | return -ENOMEM; | 320 | return -ENOMEM; |
309 | 321 | ||
310 | if (dev->of_node && !pdata) { | 322 | if (dev->of_node && !pdata) { |
311 | ret = act8865_pdata_from_dt(dev, of_node, &pdata_of, matches, | 323 | ret = act8865_pdata_from_dt(dev, of_node, &pdata_of, type); |
312 | num_regulators); | ||
313 | if (ret < 0) | 324 | if (ret < 0) |
314 | return ret; | 325 | return ret; |
315 | 326 | ||