Commit db551682 authored by Stephen Warren's avatar Stephen Warren Committed by Mark Brown

regulator: max8907: fix compile error when !CONFIG_OF

Fix the following:

  CC [M]  drivers/regulator/max8907-regulator.o
drivers/regulator/max8907-regulator.c: In function 'max8907_regulator_probe':
drivers/regulator/max8907-regulator.c:297:12: error: 'max8907_matches' undeclared (first use in this function)

by removing direct references to max8907_matches[], which only exists when
CONFIG_OF is defined.
Signed-off-by: default avatarStephen Warren <swarren@nvidia.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 0764ef59
...@@ -248,11 +248,31 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev) ...@@ -248,11 +248,31 @@ static int max8907_regulator_parse_dt(struct platform_device *pdev)
return 0; return 0;
} }
static inline struct regulator_init_data *match_init_data(int index)
{
return max8907_matches[index].init_data;
}
static inline struct device_node *match_of_node(int index)
{
return max8907_matches[index].of_node;
}
#else #else
static int max8907_regulator_parse_dt(struct platform_device *pdev) static int max8907_regulator_parse_dt(struct platform_device *pdev)
{ {
return 0; return 0;
} }
static inline struct regulator_init_data *match_init_data(int index)
{
return NULL;
}
static inline struct device_node *match_of_node(int index)
{
return NULL;
}
#endif #endif
static __devinit int max8907_regulator_probe(struct platform_device *pdev) static __devinit int max8907_regulator_probe(struct platform_device *pdev)
...@@ -295,11 +315,11 @@ static __devinit int max8907_regulator_probe(struct platform_device *pdev) ...@@ -295,11 +315,11 @@ static __devinit int max8907_regulator_probe(struct platform_device *pdev)
if (pdata) if (pdata)
idata = pdata->init_data[i]; idata = pdata->init_data[i];
else else
idata = max8907_matches[i].init_data; idata = match_init_data(i);
config.init_data = idata; config.init_data = idata;
config.driver_data = pmic; config.driver_data = pmic;
config.regmap = max8907->regmap_gen; config.regmap = max8907->regmap_gen;
config.of_node = max8907_matches[i].of_node; config.of_node = match_of_node(i);
switch (pmic->desc[i].id) { switch (pmic->desc[i].id) {
case MAX8907_MBATT: case MAX8907_MBATT:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment