[PATCH 2/2] regulator: arizona-ldo1: Fix build errors for when CONFIG_OF not defined

From: Charles Keepax
Date: Fri Apr 25 2014 - 11:57:12 EST


Some of the OF handling functions do not have empty alternatives defined
if CONFIG_OF is not defined. This patch ifdefs out the offending code.

Reported-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Signed-off-by: Charles Keepax <ckeepax@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
---
drivers/regulator/arizona-ldo1.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c
index d3787e1..051db72f 100644
--- a/drivers/regulator/arizona-ldo1.c
+++ b/drivers/regulator/arizona-ldo1.c
@@ -179,6 +179,7 @@ static const struct regulator_init_data arizona_ldo1_default = {
.num_consumer_supplies = 1,
};

+#if IS_ENABLED(CONFIG_OF)
static int arizona_ldo1_of_get_pdata(struct arizona *arizona,
struct regulator_config *config)
{
@@ -215,6 +216,22 @@ static int arizona_ldo1_of_get_pdata(struct arizona *arizona,
return 0;
}

+static void arizona_ldo1_of_put_pdata(struct regulator_config *config)
+{
+ of_node_put(config->of_node);
+}
+#else
+static int arizona_ldo1_of_get_pdata(struct arizona *arizona,
+ struct regulator_config *config)
+{
+ return 0;
+}
+
+static void arizona_ldo1_of_put_pdata(struct regulator_config *config)
+{
+}
+#endif
+
static int arizona_ldo1_probe(struct platform_device *pdev)
{
struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
@@ -286,7 +303,8 @@ static int arizona_ldo1_probe(struct platform_device *pdev)
return ret;
}

- of_node_put(config.of_node);
+ if (IS_ENABLED(CONFIG_OF))
+ arizona_ldo1_of_put_pdata(&config);

platform_set_drvdata(pdev, ldo1);

--
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/