Skip to contentSkip to conversation

regulator: arizona-micsupp: Fix build errors with CONFIG_OF not defined

PATCH In review Charles Keepax 2 participants 5 messages Apr 25, 2014 – Apr 26, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 regulator: arizona-micsupp: Fix build errors with CONFIG_OF not defined

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.

---
 drivers/regulator/arizona-micsupp.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/regulator/arizona-micsupp.c +19 -1
index b80ebbe..19d0b2c 100644
@@ -196,6 +196,7 @@ static const struct regulator_init_data arizona_micsupp_ext_default = {
 	.num_consumer_supplies = 1,
 };
 
+#if IS_ENABLED(CONFIG_OF)
 static int arizona_micsupp_of_get_pdata(struct arizona *arizona,
 					struct regulator_config *config)
 {
@@ -222,6 +223,22 @@ static int arizona_micsupp_of_get_pdata(struct arizona *arizona,
 	return 0;
 }
 
+static void arizona_micsupp_of_put_pdata(struct regulator_config *config)
+{
+	of_node_put(config->of_node);
+}
+#else
+static int arizona_micsupp_of_get_pdata(struct arizona *arizona,
+					struct regulator_config *config)
+{
+	return 0;
+}
+
+static void arizona_micsupp_of_put_pdata(struct regulator_config *config)
+{
+}
+#endif
+
 static int arizona_micsupp_probe(struct platform_device *pdev)
 {
 	struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
@@ -288,7 +305,8 @@ static int arizona_micsupp_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	of_node_put(config.of_node);
+	if (IS_ENABLED(CONFIG_OF))
+		arizona_micsupp_of_put_pdata(&config);
 
 	platform_set_drvdata(pdev, micsupp);
 
Signature · 1 line
1.7.9.5
#1 lore raw

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

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.

---
 drivers/regulator/arizona-ldo1.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/regulator/arizona-ldo1.c +19 -1
index d3787e1..051db72f 100644
@@ -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);
 
Signature · 1 line
1.7.9.5
maintainer
#2 lore raw
In reply to Charles Keepax
Quoted 2 lines · Charles Keepax

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.

Which functions and why is it not better to provide the stubs?

#3 lore raw
Quoted 6 lines · Mark Brown
Quoted 2 lines · Charles Keepax

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.

Which functions and why is it not better to provide the stubs?

Specifically of_get_child_by_name, of_parse_handle and of_node_put, I guess stub would probably be better. I will do a patch for that instead.

Thanks,
Charles

maintainer
#4 lore raw
Quoted 11 lines · Charles Keepax
Quoted 6 lines · Mark Brown
Quoted 2 lines · Charles Keepax

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.

Which functions and why is it not better to provide the stubs?

Specifically of_get_child_by_name, of_parse_handle and of_node_put, I guess stub would probably be better. I will do a patch for that instead.

There's already a stub for of_get_child_by_name() in current code. of_parse_handle() might not be ideal, I'd need to check the usage, but I'd definitely expect to see a stub for of_node_put(), it's quite common to need it even for fairly basic parsing.