Skip to contentSkip to conversation

max8925_power: Use "IS_ENABLED(CONFIG_OF)" for DT code.

PATCH Superseded Manish Badarkhe 4 participants 9 messages Jan 26, 2014 – Jan 27, 2014 Arm Samsung Exynos

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 max8925_power: Use "IS_ENABLED(CONFIG_OF)" for DT code.

Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)" option for DT code to avoid if-deffery in code.

---
:100644 100644 b4513f2... d353fbc... M drivers/power/max8925_power.c

 drivers/power/max8925_power.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/power/max8925_power.c +5 -9
index b4513f2..d353fbc 100644
@@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct max8925_power_info *info)
 	return 0;
 }
 
-#ifdef CONFIG_OF
 static struct max8925_power_pdata *
 max8925_power_dt_init(struct platform_device *pdev)
 {
@@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device *pdev)
 
 	return pdata;
 }
-#else
-static struct max8925_power_pdata *
-max8925_power_dt_init(struct platform_device *pdev)
-{
-	return pdev->dev.platform_data;
-}
-#endif
 
 static int max8925_power_probe(struct platform_device *pdev)
 {
@@ -483,7 +475,11 @@ static int max8925_power_probe(struct platform_device *pdev)
 	struct max8925_power_info *info;
 	int ret;
 
-	pdata = max8925_power_dt_init(pdev);
+	if (IS_ENABLED(CONFIG_OF))
+		pdata = max8925_power_dt_init(pdev);
+	else
+		pdata = pdev->dev.platform_data;
+
 	if (!pdata) {
 		dev_err(&pdev->dev, "platform data isn't assigned to "
 			"power supply\n");
Signature · 1 line
1.7.10.4
#1 lore raw

Hi Manish,

Quoted 36 lines · Manish Badarkhe

Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)" option for DT code to avoid if-deffery in code.

---
:100644 100644 b4513f2... d353fbc... M drivers/power/max8925_power.c

  drivers/power/max8925_power.c |   14 +++++---------
  1 file changed, 5 insertions(+), 9 deletions(-)
drivers/power/max8925_power.c +0 -8
index b4513f2..d353fbc 100644
@@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct max8925_power_info *info)
  	return 0;
  }
 
-#ifdef CONFIG_OF
  static struct max8925_power_pdata *
  max8925_power_dt_init(struct platform_device *pdev)
  {
@@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device *pdev)
 
  	return pdata;
  }
-#else
-static struct max8925_power_pdata *
-max8925_power_dt_init(struct platform_device *pdev)
-{
-	return pdev->dev.platform_data;
-}
-#endif
 
  static int max8925_power_probe(struct platform_device *pdev)
  {

drivers/power/max8925_power.c static int max8925_power_probe(struct platform_device *pdev) · line 482

Quoted 9 lines
drivers/power/max8925_power.c +5 -1
@@ -483,7 +475,11 @@ static int max8925_power_probe(struct platform_device *pdev)
  	struct max8925_power_info *info;
  	int ret;
 
-	pdata = max8925_power_dt_init(pdev);
+	if (IS_ENABLED(CONFIG_OF))
+		pdata = max8925_power_dt_init(pdev);
+	else
+		pdata = pdev->dev.platform_data;
+

This does not look much better than before this patch. Instead of "if-deffery" outside function bodies you are adding "iffery" (if there is such a word) inside a function.

What about adding

	if (!IS_ENABLED(CONFIG_OF))
		return pdev->dev.platform_data;

on top of max8925_power_dt_init() instead or maybe also renaming this function to max8925_get_pdata()?

Best regards,
Tomasz

#2 lore raw

Hi Tomasz,

Thank you for your review comments.

Quoted 56 lines · Tomasz Figa

Hi Manish,

Quoted 37 lines · Manish Badarkhe

Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)" option for DT code to avoid if-deffery in code.

---
:100644 100644 b4513f2... d353fbc... M drivers/power/max8925_power.c

  drivers/power/max8925_power.c |   14 +++++---------
  1 file changed, 5 insertions(+), 9 deletions(-)
drivers/power/max8925_power.c +0 -8
index b4513f2..d353fbc 100644
@@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct max8925_power_info *info)
        return 0;
  }
 
-#ifdef CONFIG_OF
  static struct max8925_power_pdata *
  max8925_power_dt_init(struct platform_device *pdev)
  {
@@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device *pdev)
 
        return pdata;
  }
-#else
-static struct max8925_power_pdata *
-max8925_power_dt_init(struct platform_device *pdev)
-{
-       return pdev->dev.platform_data;
-}
-#endif
 
  static int max8925_power_probe(struct platform_device *pdev)
  {

drivers/power/max8925_power.c static int max8925_power_probe(struct platform_device *pdev) · line 482

Quoted 9 lines
drivers/power/max8925_power.c +5 -1
@@ -483,7 +475,11 @@ static int max8925_power_probe(struct platform_device *pdev)
        struct max8925_power_info *info;
        int ret;
 
-       pdata = max8925_power_dt_init(pdev);
+       if (IS_ENABLED(CONFIG_OF))
+               pdata = max8925_power_dt_init(pdev);
+       else
+               pdata = pdev->dev.platform_data;
+

This does not look much better than before this patch. Instead of "if-deffery" outside function bodies you are adding "iffery" (if there is such a word) inside a function. What about adding

Quoted 4 lines
        if (!IS_ENABLED(CONFIG_OF))
                return pdev->dev.platform_data;

on top of max8925_power_dt_init() instead or maybe also renaming this function to max8925_get_pdata()?

Okay, I will rename function "max8925_power_dt_init()" to "max8925_get_pdata()". As you suggested, in the body of this function will add a logic to retrieve data in case
of DT and non-DT platforms.

Regards
Manish Badarkhe

#3 lore raw
Quoted 64 lines · Manish Badarkhe

Hi Tomasz,

Thank you for your review comments.

Quoted 59 lines · Tomasz Figa

Hi Manish,

Quoted 37 lines · Manish Badarkhe

Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)" option for DT code to avoid if-deffery in code.

---
:100644 100644 b4513f2... d353fbc... M drivers/power/max8925_power.c

  drivers/power/max8925_power.c |   14 +++++---------
  1 file changed, 5 insertions(+), 9 deletions(-)
drivers/power/max8925_power.c +0 -8
index b4513f2..d353fbc 100644
@@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct max8925_power_info *info)
        return 0;
  }
 
-#ifdef CONFIG_OF
  static struct max8925_power_pdata *
  max8925_power_dt_init(struct platform_device *pdev)
  {
@@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device *pdev)
 
        return pdata;
  }
-#else
-static struct max8925_power_pdata *
-max8925_power_dt_init(struct platform_device *pdev)
-{
-       return pdev->dev.platform_data;
-}
-#endif
 
  static int max8925_power_probe(struct platform_device *pdev)
  {

drivers/power/max8925_power.c static int max8925_power_probe(struct platform_device *pdev) · line 482

Quoted 9 lines
drivers/power/max8925_power.c +5 -1
@@ -483,7 +475,11 @@ static int max8925_power_probe(struct platform_device *pdev)
        struct max8925_power_info *info;
        int ret;
 
-       pdata = max8925_power_dt_init(pdev);
+       if (IS_ENABLED(CONFIG_OF))
+               pdata = max8925_power_dt_init(pdev);
+       else
+               pdata = pdev->dev.platform_data;
+

This does not look much better than before this patch. Instead of "if-deffery" outside function bodies you are adding "iffery" (if there is such a word) inside a function. What about adding

        if (!IS_ENABLED(CONFIG_OF))
                return pdev->dev.platform_data;
Quoted 6 lines
Quoted 1 line

on top of max8925_power_dt_init() instead or maybe also renaming this function to max8925_get_pdata()?

Okay, I will rename function "max8925_power_dt_init()" to "max8925_get_pdata()". As you suggested, in the body of this function will add a logic to retrieve data in case
of DT and non-DT platforms.

Should we not always favor platform-supplied data regardless of CONFIG_OF state and fall back to DT (firmware) supplied data if platform data is absent? This way one can tweak kernel behavior without needing to change firmware.

Thanks.

Signature · 1 line
Dmitry
#4 lore raw
Quoted 72 lines · Dmitry Torokhov
Quoted 64 lines · Manish Badarkhe

Hi Tomasz,

Thank you for your review comments.

Quoted 59 lines · Tomasz Figa

Hi Manish,

Quoted 37 lines · Manish Badarkhe

Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)" option for DT code to avoid if-deffery in code.

---
:100644 100644 b4513f2... d353fbc... M drivers/power/max8925_power.c

   drivers/power/max8925_power.c |   14 +++++---------
   1 file changed, 5 insertions(+), 9 deletions(-)
drivers/power/max8925_power.c +0 -8
index b4513f2..d353fbc 100644
@@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct max8925_power_info *info)
         return 0;
   }
 
-#ifdef CONFIG_OF
   static struct max8925_power_pdata *
   max8925_power_dt_init(struct platform_device *pdev)
   {
@@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device *pdev)
 
         return pdata;
   }
-#else
-static struct max8925_power_pdata *
-max8925_power_dt_init(struct platform_device *pdev)
-{
-       return pdev->dev.platform_data;
-}
-#endif
 
   static int max8925_power_probe(struct platform_device *pdev)
   {

drivers/power/max8925_power.c static int max8925_power_probe(struct platform_device *pdev) · line 482

Quoted 9 lines
drivers/power/max8925_power.c +5 -1
@@ -483,7 +475,11 @@ static int max8925_power_probe(struct platform_device *pdev)
         struct max8925_power_info *info;
         int ret;
 
-       pdata = max8925_power_dt_init(pdev);
+       if (IS_ENABLED(CONFIG_OF))
+               pdata = max8925_power_dt_init(pdev);
+       else
+               pdata = pdev->dev.platform_data;
+

This does not look much better than before this patch. Instead of "if-deffery" outside function bodies you are adding "iffery" (if there is such a word) inside a function. What about adding

         if (!IS_ENABLED(CONFIG_OF))
                 return pdev->dev.platform_data;
Quoted 6 lines
Quoted 1 line

on top of max8925_power_dt_init() instead or maybe also renaming this function to max8925_get_pdata()?

Okay, I will rename function "max8925_power_dt_init()" to "max8925_get_pdata()". As you suggested, in the body of this function will add a logic to retrieve data in case
of DT and non-DT platforms.

Quoted 4 lines

Should we not always favor platform-supplied data regardless of CONFIG_OF state and fall back to DT (firmware) supplied data if platform data is absent? This way one can tweak kernel behavior without needing to change firmware.

I guess we should, but apparently this was not the original behavior before this patch, so I'm not sure if we should be squashing such semantic change with this simple refactor.

Best regards,
Tomasz

#5 lore raw
Quoted 95 lines · Tomasz Figa
Quoted 88 lines · Dmitry Torokhov
Quoted 79 lines · Manish Badarkhe

Hi Tomasz,

Thank you for your review comments.

Quoted 65 lines · Tomasz Figa

Hi Manish,

Quoted 41 lines · Manish Badarkhe

Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)" option for DT code to avoid if-deffery in code.

---
:100644 100644 b4513f2... d353fbc... M drivers/power/max8925_power.c

   drivers/power/max8925_power.c |   14 +++++---------
   1 file changed, 5 insertions(+), 9 deletions(-)
drivers/power/max8925_power.c +0 -1
index b4513f2..d353fbc 100644
@@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct
 max8925_power_info *info)
         return 0;
   }
 
-#ifdef CONFIG_OF
   static struct max8925_power_pdata *
   max8925_power_dt_init(struct platform_device *pdev)
   {
drivers/power/max8925_power.c +0 -7
@@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device
 *pdev)
 
         return pdata;
   }
-#else
-static struct max8925_power_pdata *
-max8925_power_dt_init(struct platform_device *pdev)
-{
-       return pdev->dev.platform_data;
-}
-#endif
 
   static int max8925_power_probe(struct platform_device *pdev)
   {

drivers/power/max8925_power.c static int max8925_power_probe(struct · line 483

Quoted 10 lines
drivers/power/max8925_power.c +5 -1
@@ -483,7 +475,11 @@ static int max8925_power_probe(struct
 platform_device *pdev)
         struct max8925_power_info *info;
         int ret;
 
-       pdata = max8925_power_dt_init(pdev);
+       if (IS_ENABLED(CONFIG_OF))
+               pdata = max8925_power_dt_init(pdev);
+       else
+               pdata = pdev->dev.platform_data;
+

This does not look much better than before this patch. Instead of "if-deffery" outside function bodies you are adding "iffery" (if there is such a word) inside a function.
What about adding

Quoted 5 lines
         if (!IS_ENABLED(CONFIG_OF))
                 return pdev->dev.platform_data;

on top of max8925_power_dt_init() instead or maybe also renaming this function to max8925_get_pdata()?

Quoted 5 lines

Okay, I will rename function "max8925_power_dt_init()" to "max8925_get_pdata()".
As you suggested, in the body of this function will add a logic to retrieve data in case
of DT and non-DT platforms.

Quoted 4 lines

Should we not always favor platform-supplied data regardless of CONFIG_OF state and fall back to DT (firmware) supplied data if platform data is absent? This way one can tweak kernel behavior without needing to change firmware.

Quoted 3 lines

I guess we should, but apparently this was not the original behavior before this patch, so I'm not sure if we should be squashing such semantic change with this simple refactor.

Hmm. Judging from the code, max8925_power_dt_init() function follows exactly opposite strategy - it uses platform_data if of_node is not populated/available. So (if dt_init will compile with CONFIG_OF disabled) one can always use _dt_init()
function to retrieve pdata.

Signature · 2 lines
With best wishes
Dmitry
#6 lore raw
Quoted 100 lines · Dmitry Eremin-Solenikov
Quoted 95 lines · Tomasz Figa
Quoted 88 lines · Dmitry Torokhov
Quoted 79 lines · Manish Badarkhe

Hi Tomasz,

Thank you for your review comments.

Quoted 65 lines · Tomasz Figa

Hi Manish,

Quoted 41 lines · Manish Badarkhe

Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)" option for DT code to avoid if-deffery in code.

---
:100644 100644 b4513f2... d353fbc... M drivers/power/max8925_power.c

   drivers/power/max8925_power.c |   14 +++++---------
   1 file changed, 5 insertions(+), 9 deletions(-)
drivers/power/max8925_power.c +0 -1
index b4513f2..d353fbc 100644
@@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct
 max8925_power_info *info)
         return 0;
   }
 
-#ifdef CONFIG_OF
   static struct max8925_power_pdata *
   max8925_power_dt_init(struct platform_device *pdev)
   {
drivers/power/max8925_power.c +0 -7
@@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device
 *pdev)
 
         return pdata;
   }
-#else
-static struct max8925_power_pdata *
-max8925_power_dt_init(struct platform_device *pdev)
-{
-       return pdev->dev.platform_data;
-}
-#endif
 
   static int max8925_power_probe(struct platform_device *pdev)
   {

drivers/power/max8925_power.c static int max8925_power_probe(struct · line 483

Quoted 10 lines
drivers/power/max8925_power.c +5 -1
@@ -483,7 +475,11 @@ static int max8925_power_probe(struct
 platform_device *pdev)
         struct max8925_power_info *info;
         int ret;
 
-       pdata = max8925_power_dt_init(pdev);
+       if (IS_ENABLED(CONFIG_OF))
+               pdata = max8925_power_dt_init(pdev);
+       else
+               pdata = pdev->dev.platform_data;
+

This does not look much better than before this patch. Instead of "if-deffery" outside function bodies you are adding "iffery" (if there is such a word) inside a function.
What about adding

Quoted 5 lines
         if (!IS_ENABLED(CONFIG_OF))
                 return pdev->dev.platform_data;

on top of max8925_power_dt_init() instead or maybe also renaming this function to max8925_get_pdata()?

Quoted 5 lines

Okay, I will rename function "max8925_power_dt_init()" to "max8925_get_pdata()".
As you suggested, in the body of this function will add a logic to retrieve data in case
of DT and non-DT platforms.

Quoted 4 lines

Should we not always favor platform-supplied data regardless of CONFIG_OF state and fall back to DT (firmware) supplied data if platform data is absent? This way one can tweak kernel behavior without needing to change firmware.

Quoted 3 lines

I guess we should, but apparently this was not the original behavior before this patch, so I'm not sure if we should be squashing such semantic change with this simple refactor.

Quoted 5 lines

Hmm. Judging from the code, max8925_power_dt_init() function follows exactly opposite strategy - it uses platform_data if of_node is not populated/available. So (if dt_init will compile with CONFIG_OF disabled) one can always use _dt_init()
function to retrieve pdata.

Right, and I question whether this is good behavior or if it should be corrected.

Thanks.

Signature · 1 line
Dmitry
#7 lore raw
Quoted 101 lines · Dmitry Torokhov
Quoted 100 lines · Dmitry Eremin-Solenikov
Quoted 98 lines · Tomasz Figa
Quoted 88 lines · Dmitry Torokhov
Quoted 79 lines · Manish Badarkhe

Hi Tomasz,

Thank you for your review comments.

Quoted 65 lines · Tomasz Figa

Hi Manish,

Quoted 41 lines · Manish Badarkhe

Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)" option for DT code to avoid if-deffery in code.

---
:100644 100644 b4513f2... d353fbc... M drivers/power/max8925_power.c

   drivers/power/max8925_power.c |   14 +++++---------
   1 file changed, 5 insertions(+), 9 deletions(-)
drivers/power/max8925_power.c +0 -1
index b4513f2..d353fbc 100644
@@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct
 max8925_power_info *info)
         return 0;
   }
 
-#ifdef CONFIG_OF
   static struct max8925_power_pdata *
   max8925_power_dt_init(struct platform_device *pdev)
   {
drivers/power/max8925_power.c +0 -7
@@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device
 *pdev)
 
         return pdata;
   }
-#else
-static struct max8925_power_pdata *
-max8925_power_dt_init(struct platform_device *pdev)
-{
-       return pdev->dev.platform_data;
-}
-#endif
 
   static int max8925_power_probe(struct platform_device *pdev)
   {

drivers/power/max8925_power.c static int max8925_power_probe(struct · line 483

Quoted 10 lines
drivers/power/max8925_power.c +5 -1
@@ -483,7 +475,11 @@ static int max8925_power_probe(struct
 platform_device *pdev)
         struct max8925_power_info *info;
         int ret;
 
-       pdata = max8925_power_dt_init(pdev);
+       if (IS_ENABLED(CONFIG_OF))
+               pdata = max8925_power_dt_init(pdev);
+       else
+               pdata = pdev->dev.platform_data;
+

This does not look much better than before this patch. Instead of "if-deffery" outside function bodies you are adding "iffery" (if there is such a word) inside a function.
What about adding

Quoted 5 lines
         if (!IS_ENABLED(CONFIG_OF))
                 return pdev->dev.platform_data;

on top of max8925_power_dt_init() instead or maybe also renaming this function to max8925_get_pdata()?

Quoted 5 lines

Okay, I will rename function "max8925_power_dt_init()" to "max8925_get_pdata()".
As you suggested, in the body of this function will add a logic to retrieve data in case
of DT and non-DT platforms.

Quoted 4 lines

Should we not always favor platform-supplied data regardless of CONFIG_OF state and fall back to DT (firmware) supplied data if platform data is absent? This way one can tweak kernel behavior without needing to change firmware.

I guess we should, but apparently this was not the original behavior before this patch, so I'm not sure if we should be squashing such semantic change with this simple refactor.

Quoted 8 lines
Quoted 5 lines

Hmm. Judging from the code, max8925_power_dt_init() function follows exactly opposite strategy - it uses platform_data if of_node is not populated/available. So (if dt_init will compile with CONFIG_OF disabled) one can always use _dt_init()
function to retrieve pdata.

Right, and I question whether this is good behavior or if it should be corrected.

I'd say, correct it.

Signature · 2 lines
With best wishes
Dmitry
#8 lore raw

Hi

Thank you for review.

Quoted 109 lines · Dmitry Eremin-Solenikov
Quoted 107 lines · Dmitry Torokhov
Quoted 105 lines · Dmitry Eremin-Solenikov
Quoted 95 lines · Tomasz Figa
Quoted 88 lines · Dmitry Torokhov
Quoted 79 lines · Manish Badarkhe

Hi Tomasz,

Thank you for your review comments.

Quoted 65 lines · Tomasz Figa

Hi Manish,

Quoted 41 lines · Manish Badarkhe

Instead of "#if define CONFIG_OF" use "IS_ENABLED(CONFIG_OF)" option for DT code to avoid if-deffery in code.

---
:100644 100644 b4513f2... d353fbc... M drivers/power/max8925_power.c

   drivers/power/max8925_power.c |   14 +++++---------
   1 file changed, 5 insertions(+), 9 deletions(-)
drivers/power/max8925_power.c +0 -1
index b4513f2..d353fbc 100644
@@ -427,7 +427,6 @@ static int max8925_deinit_charger(struct
 max8925_power_info *info)
         return 0;
   }
 
-#ifdef CONFIG_OF
   static struct max8925_power_pdata *
   max8925_power_dt_init(struct platform_device *pdev)
   {
drivers/power/max8925_power.c +0 -7
@@ -468,13 +467,6 @@ max8925_power_dt_init(struct platform_device
 *pdev)
 
         return pdata;
   }
-#else
-static struct max8925_power_pdata *
-max8925_power_dt_init(struct platform_device *pdev)
-{
-       return pdev->dev.platform_data;
-}
-#endif
 
   static int max8925_power_probe(struct platform_device *pdev)
   {

drivers/power/max8925_power.c static int max8925_power_probe(struct · line 483

Quoted 10 lines
drivers/power/max8925_power.c +5 -1
@@ -483,7 +475,11 @@ static int max8925_power_probe(struct
 platform_device *pdev)
         struct max8925_power_info *info;
         int ret;
 
-       pdata = max8925_power_dt_init(pdev);
+       if (IS_ENABLED(CONFIG_OF))
+               pdata = max8925_power_dt_init(pdev);
+       else
+               pdata = pdev->dev.platform_data;
+

This does not look much better than before this patch. Instead of "if-deffery" outside function bodies you are adding "iffery" (if there is such a word) inside a function.
What about adding

Quoted 5 lines
         if (!IS_ENABLED(CONFIG_OF))
                 return pdev->dev.platform_data;

on top of max8925_power_dt_init() instead or maybe also renaming this function to max8925_get_pdata()?

Quoted 5 lines

Okay, I will rename function "max8925_power_dt_init()" to "max8925_get_pdata()".
As you suggested, in the body of this function will add a logic to retrieve data in case
of DT and non-DT platforms.

Quoted 4 lines

Should we not always favor platform-supplied data regardless of CONFIG_OF state and fall back to DT (firmware) supplied data if platform data is absent? This way one can tweak kernel behavior without needing to change firmware.

Quoted 3 lines

I guess we should, but apparently this was not the original behavior before this patch, so I'm not sure if we should be squashing such semantic change with this simple refactor.

Hmm. Judging from the code, max8925_power_dt_init() function follows exactly opposite strategy - it uses platform_data if of_node is not populated/available. So (if dt_init will compile with CONFIG_OF disabled) one can always use _dt_init()
function to retrieve pdata.

Quoted 4 lines
Quoted 2 lines

Right, and I question whether this is good behavior or if it should be corrected.

I'd say, correct it.

Okay, I will update code as per Dmitry's feedback.

Regards
Manish Badarkhe