All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: arizona-micsupp: Fix build errors with CONFIG_OF not defined
@ 2014-04-25 15:55 Charles Keepax
  2014-04-25 15:55 ` [PATCH 2/2] regulator: arizona-ldo1: Fix build errors for when " Charles Keepax
  2014-04-25 16:11 ` [PATCH 1/2] regulator: arizona-micsupp: Fix build errors with " Mark Brown
  0 siblings, 2 replies; 5+ messages in thread
From: Charles Keepax @ 2014-04-25 15:55 UTC (permalink / raw)
  To: broonie; +Cc: lgirdwood, linux-kernel, patches, 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.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 drivers/regulator/arizona-micsupp.c |   20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c
index b80ebbe..19d0b2c 100644
--- a/drivers/regulator/arizona-micsupp.c
+++ b/drivers/regulator/arizona-micsupp.c
@@ -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);
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] regulator: arizona-ldo1: Fix build errors for when CONFIG_OF not defined
  2014-04-25 15:55 [PATCH 1/2] regulator: arizona-micsupp: Fix build errors with CONFIG_OF not defined Charles Keepax
@ 2014-04-25 15:55 ` Charles Keepax
  2014-04-25 16:11 ` [PATCH 1/2] regulator: arizona-micsupp: Fix build errors with " Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Charles Keepax @ 2014-04-25 15:55 UTC (permalink / raw)
  To: broonie; +Cc: lgirdwood, linux-kernel, patches, 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.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] regulator: arizona-micsupp: Fix build errors with CONFIG_OF not defined
  2014-04-25 15:55 [PATCH 1/2] regulator: arizona-micsupp: Fix build errors with CONFIG_OF not defined Charles Keepax
  2014-04-25 15:55 ` [PATCH 2/2] regulator: arizona-ldo1: Fix build errors for when " Charles Keepax
@ 2014-04-25 16:11 ` Mark Brown
  2014-04-25 20:30   ` Charles Keepax
  1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2014-04-25 16:11 UTC (permalink / raw)
  To: Charles Keepax; +Cc: lgirdwood, linux-kernel, patches

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

On Fri, Apr 25, 2014 at 04:55:40PM +0100, Charles Keepax wrote:

> 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?

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] regulator: arizona-micsupp: Fix build errors with CONFIG_OF not defined
  2014-04-25 16:11 ` [PATCH 1/2] regulator: arizona-micsupp: Fix build errors with " Mark Brown
@ 2014-04-25 20:30   ` Charles Keepax
  2014-04-26 16:59     ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Charles Keepax @ 2014-04-25 20:30 UTC (permalink / raw)
  To: Mark Brown; +Cc: lgirdwood, linux-kernel, patches

On Fri, Apr 25, 2014 at 05:11:38PM +0100, Mark Brown wrote:
> On Fri, Apr 25, 2014 at 04:55:40PM +0100, Charles Keepax wrote:
> 
> > 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] regulator: arizona-micsupp: Fix build errors with CONFIG_OF not defined
  2014-04-25 20:30   ` Charles Keepax
@ 2014-04-26 16:59     ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2014-04-26 16:59 UTC (permalink / raw)
  To: Charles Keepax; +Cc: lgirdwood, linux-kernel, patches

[-- Attachment #1: Type: text/plain, Size: 823 bytes --]

On Fri, Apr 25, 2014 at 09:30:53PM +0100, Charles Keepax wrote:
> On Fri, Apr 25, 2014 at 05:11:38PM +0100, Mark Brown wrote:
> > On Fri, Apr 25, 2014 at 04:55:40PM +0100, Charles Keepax wrote:

> > > 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.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-26 16:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-25 15:55 [PATCH 1/2] regulator: arizona-micsupp: Fix build errors with CONFIG_OF not defined Charles Keepax
2014-04-25 15:55 ` [PATCH 2/2] regulator: arizona-ldo1: Fix build errors for when " Charles Keepax
2014-04-25 16:11 ` [PATCH 1/2] regulator: arizona-micsupp: Fix build errors with " Mark Brown
2014-04-25 20:30   ` Charles Keepax
2014-04-26 16:59     ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.