devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] dt: export of_have_populated_dt
@ 2012-04-10 15:11 Balaji T K
  2012-04-10 16:19 ` Cousson, Benoit
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Balaji T K @ 2012-04-10 15:11 UTC (permalink / raw)
  To: robherring2, devicetree-discuss
  Cc: linux-omap, rnayak, cjb, bigeasy, Balaji T K

If of_have_populated_dt is called from module, build fails with "allnodes"
undefined error, so remove inline and export of_have_populated_dt.

Signed-off-by: Balaji T K <balajitk@ti.com>
---
 drivers/of/base.c  |    6 ++++++
 include/linux/of.h |    6 +-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 5806449..dc1af42 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -186,6 +186,12 @@ struct property *of_find_property(const struct device_node *np,
 }
 EXPORT_SYMBOL(of_find_property);
 
+bool of_have_populated_dt(void)
+{
+	return allnodes != NULL;
+}
+EXPORT_SYMBOL(of_have_populated_dt);
+
 /**
  * of_find_all_nodes - Get next node in global list
  * @prev:	Previous node or NULL to start iteration
diff --git a/include/linux/of.h b/include/linux/of.h
index fa7fb1d..28e933e 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -92,11 +92,6 @@ extern struct device_node *of_chosen;
 extern struct device_node *of_aliases;
 extern rwlock_t devtree_lock;
 
-static inline bool of_have_populated_dt(void)
-{
-	return allnodes != NULL;
-}
-
 static inline bool of_node_is_root(const struct device_node *node)
 {
 	return node && (node->parent == NULL);
@@ -112,6 +107,7 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
 	set_bit(flag, &n->_flags);
 }
 
+extern bool of_have_populated_dt(void);
 extern struct device_node *of_find_all_nodes(struct device_node *prev);
 
 /*
-- 
1.7.0.4


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

* Re: [RFC] dt: export of_have_populated_dt
  2012-04-10 15:11 [RFC] dt: export of_have_populated_dt Balaji T K
@ 2012-04-10 16:19 ` Cousson, Benoit
       [not found]   ` <4F845D99.7020705-l0cyMroinI0@public.gmane.org>
       [not found] ` <1334070672-11252-1-git-send-email-balajitk-l0cyMroinI0@public.gmane.org>
  2012-04-11  4:18 ` Rajendra Nayak
  2 siblings, 1 reply; 9+ messages in thread
From: Cousson, Benoit @ 2012-04-10 16:19 UTC (permalink / raw)
  To: Balaji T K
  Cc: robherring2, devicetree-discuss, linux-omap, rnayak, cjb, bigeasy

Hi Balaji,

On 4/10/2012 5:11 PM, Balaji T K wrote:
> If of_have_populated_dt is called from module, build fails with "allnodes"
> undefined error, so remove inline and export of_have_populated_dt.

Is this function really called from the MMC driver?

Regards,
Benoit

>
> Signed-off-by: Balaji T K<balajitk@ti.com>
> ---
>   drivers/of/base.c  |    6 ++++++
>   include/linux/of.h |    6 +-----
>   2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 5806449..dc1af42 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -186,6 +186,12 @@ struct property *of_find_property(const struct device_node *np,
>   }
>   EXPORT_SYMBOL(of_find_property);
>
> +bool of_have_populated_dt(void)
> +{
> +	return allnodes != NULL;
> +}
> +EXPORT_SYMBOL(of_have_populated_dt);
> +
>   /**
>    * of_find_all_nodes - Get next node in global list
>    * @prev:	Previous node or NULL to start iteration
> diff --git a/include/linux/of.h b/include/linux/of.h
> index fa7fb1d..28e933e 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -92,11 +92,6 @@ extern struct device_node *of_chosen;
>   extern struct device_node *of_aliases;
>   extern rwlock_t devtree_lock;
>
> -static inline bool of_have_populated_dt(void)
> -{
> -	return allnodes != NULL;
> -}
> -
>   static inline bool of_node_is_root(const struct device_node *node)
>   {
>   	return node&&  (node->parent == NULL);
> @@ -112,6 +107,7 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
>   	set_bit(flag,&n->_flags);
>   }
>
> +extern bool of_have_populated_dt(void);
>   extern struct device_node *of_find_all_nodes(struct device_node *prev);
>
>   /*


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

* Re: [RFC] dt: export of_have_populated_dt
       [not found]   ` <4F845D99.7020705-l0cyMroinI0@public.gmane.org>
@ 2012-04-10 16:21     ` Chris Ball
  2012-04-10 16:29       ` Cousson, Benoit
  0 siblings, 1 reply; 9+ messages in thread
From: Chris Ball @ 2012-04-10 16:21 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: Balaji T K, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, bigeasy-hfZtesqFncYOwBW4kG4KsQ

Hi,

On Tue, Apr 10 2012, Cousson, Benoit wrote:
> Hi Balaji,
>
> On 4/10/2012 5:11 PM, Balaji T K wrote:
>> If of_have_populated_dt is called from module, build fails with "allnodes"
>> undefined error, so remove inline and export of_have_populated_dt.
>
> Is this function really called from the MMC driver?

~/git/linux % git grep of_have_populated_dt drivers/
drivers/gpio/gpio-samsung.c:    if (!of_have_populated_dt())
drivers/mmc/host/omap_hsmmc.c:  if (of_have_populated_dt() && !vdd)
drivers/mmc/host/omap_hsmmc.c:                   (!of_have_populated_dt())) {

- Chris.
-- 
Chris Ball   <cjb-2X9k7bc8m7Mdnm+yROfE0A@public.gmane.org>   <http://printf.net/>
One Laptop Per Child

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

* Re: [RFC] dt: export of_have_populated_dt
  2012-04-10 16:21     ` Chris Ball
@ 2012-04-10 16:29       ` Cousson, Benoit
  2012-04-10 17:20         ` Rob Herring
  0 siblings, 1 reply; 9+ messages in thread
From: Cousson, Benoit @ 2012-04-10 16:29 UTC (permalink / raw)
  To: Chris Ball, robherring2
  Cc: Balaji T K, devicetree-discuss, linux-omap, rnayak, bigeasy

Hi Chris,

On 4/10/2012 6:21 PM, Chris Ball wrote:
> Hi,
>
> On Tue, Apr 10 2012, Cousson, Benoit wrote:
>> Hi Balaji,
>>
>> On 4/10/2012 5:11 PM, Balaji T K wrote:
>>> If of_have_populated_dt is called from module, build fails with "allnodes"
>>> undefined error, so remove inline and export of_have_populated_dt.
>>
>> Is this function really called from the MMC driver?
>
> ~/git/linux % git grep of_have_populated_dt drivers/
> drivers/gpio/gpio-samsung.c:    if (!of_have_populated_dt())
> drivers/mmc/host/omap_hsmmc.c:  if (of_have_populated_dt()&&  !vdd)
> drivers/mmc/host/omap_hsmmc.c:                   (!of_have_populated_dt())) {

Gosh, twice... I should be in a wrong branch :-(

Then the next question to Rob...

Rob,
Does it make sense to use that in the driver? So far I was using that 
only in the arch code to make the difference between the DT boot and the 
non-DT boot.

I guess that a driver should rely on of_match_device or non-NULL 
device_node to figure out that?

Thanks,
Benoit

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

* Re: [RFC] dt: export of_have_populated_dt
  2012-04-10 16:29       ` Cousson, Benoit
@ 2012-04-10 17:20         ` Rob Herring
  2012-04-10 20:33           ` Grant Likely
  2012-04-11  4:16           ` Rajendra Nayak
  0 siblings, 2 replies; 9+ messages in thread
From: Rob Herring @ 2012-04-10 17:20 UTC (permalink / raw)
  To: Cousson, Benoit
  Cc: Chris Ball, Balaji T K, devicetree-discuss, linux-omap, rnayak,
	bigeasy

On 04/10/2012 11:29 AM, Cousson, Benoit wrote:
> Hi Chris,
> 
> On 4/10/2012 6:21 PM, Chris Ball wrote:
>> Hi,
>>
>> On Tue, Apr 10 2012, Cousson, Benoit wrote:
>>> Hi Balaji,
>>>
>>> On 4/10/2012 5:11 PM, Balaji T K wrote:
>>>> If of_have_populated_dt is called from module, build fails with
>>>> "allnodes"
>>>> undefined error, so remove inline and export of_have_populated_dt.
>>>
>>> Is this function really called from the MMC driver?
>>
>> ~/git/linux % git grep of_have_populated_dt drivers/
>> drivers/gpio/gpio-samsung.c:    if (!of_have_populated_dt())
>> drivers/mmc/host/omap_hsmmc.c:  if (of_have_populated_dt()&&  !vdd)
>> drivers/mmc/host/omap_hsmmc.c:                  
>> (!of_have_populated_dt())) {
> 
> Gosh, twice... I should be in a wrong branch :-(
> 
> Then the next question to Rob...
> 
> Rob,
> Does it make sense to use that in the driver? So far I was using that
> only in the arch code to make the difference between the DT boot and the
> non-DT boot.
> 
> I guess that a driver should rely on of_match_device or non-NULL
> device_node to figure out that?
> 

Agreed. of_match_device or device_node ptr check is the right approach.

Rob

> Thanks,
> Benoit


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

* Re: [RFC] dt: export of_have_populated_dt
       [not found] ` <1334070672-11252-1-git-send-email-balajitk-l0cyMroinI0@public.gmane.org>
@ 2012-04-10 17:36   ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 9+ messages in thread
From: Sebastian Andrzej Siewior @ 2012-04-10 17:36 UTC (permalink / raw)
  To: Balaji T K
  Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, cjb-2X9k7bc8m7Mdnm+yROfE0A

On 04/10/2012 05:11 PM, Balaji T K wrote:
> If of_have_populated_dt is called from module, build fails with "allnodes"
> undefined error, so remove inline and export of_have_populated_dt.

Why do you need this function at all? You should not need it. *I*
introduced it because I need it early x86 setup code to figure out if
there a DT available or not. A driver should not care about it. You do 
have your dev.of_node and this is it.

Sebastian

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

* Re: [RFC] dt: export of_have_populated_dt
  2012-04-10 17:20         ` Rob Herring
@ 2012-04-10 20:33           ` Grant Likely
  2012-04-11  4:16           ` Rajendra Nayak
  1 sibling, 0 replies; 9+ messages in thread
From: Grant Likely @ 2012-04-10 20:33 UTC (permalink / raw)
  To: Rob Herring, Cousson, Benoit
  Cc: linux-omap, Balaji T K, devicetree-discuss, Chris Ball, bigeasy

On Tue, 10 Apr 2012 12:20:27 -0500, Rob Herring <robherring2@gmail.com> wrote:
> On 04/10/2012 11:29 AM, Cousson, Benoit wrote:
> > Hi Chris,
> > 
> > On 4/10/2012 6:21 PM, Chris Ball wrote:
> >> Hi,
> >>
> >> On Tue, Apr 10 2012, Cousson, Benoit wrote:
> >>> Hi Balaji,
> >>>
> >>> On 4/10/2012 5:11 PM, Balaji T K wrote:
> >>>> If of_have_populated_dt is called from module, build fails with
> >>>> "allnodes"
> >>>> undefined error, so remove inline and export of_have_populated_dt.
> >>>
> >>> Is this function really called from the MMC driver?
> >>
> >> ~/git/linux % git grep of_have_populated_dt drivers/
> >> drivers/gpio/gpio-samsung.c:    if (!of_have_populated_dt())
> >> drivers/mmc/host/omap_hsmmc.c:  if (of_have_populated_dt()&&  !vdd)
> >> drivers/mmc/host/omap_hsmmc.c:                  
> >> (!of_have_populated_dt())) {
> > 
> > Gosh, twice... I should be in a wrong branch :-(
> > 
> > Then the next question to Rob...
> > 
> > Rob,
> > Does it make sense to use that in the driver? So far I was using that
> > only in the arch code to make the difference between the DT boot and the
> > non-DT boot.
> > 
> > I guess that a driver should rely on of_match_device or non-NULL
> > device_node to figure out that?
> > 
> 
> Agreed. of_match_device or device_node ptr check is the right approach.

Good; I can safely ignore this patch.  :-)

g.


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

* Re: [RFC] dt: export of_have_populated_dt
  2012-04-10 17:20         ` Rob Herring
  2012-04-10 20:33           ` Grant Likely
@ 2012-04-11  4:16           ` Rajendra Nayak
  1 sibling, 0 replies; 9+ messages in thread
From: Rajendra Nayak @ 2012-04-11  4:16 UTC (permalink / raw)
  To: Rob Herring
  Cc: Cousson, Benoit, Chris Ball, Balaji T K, devicetree-discuss,
	linux-omap, bigeasy

On Tuesday 10 April 2012 10:50 PM, Rob Herring wrote:
>> Rob,
>> >  Does it make sense to use that in the driver? So far I was using that
>> >  only in the arch code to make the difference between the DT boot and the
>> >  non-DT boot.
>> >
>> >  I guess that a driver should rely on of_match_device or non-NULL
>> >  device_node to figure out that?
>> >
> Agreed. of_match_device or device_node ptr check is the right approach.

Thanks Rob, I'll post a patch to fix that up.

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

* Re: [RFC] dt: export of_have_populated_dt
  2012-04-10 15:11 [RFC] dt: export of_have_populated_dt Balaji T K
  2012-04-10 16:19 ` Cousson, Benoit
       [not found] ` <1334070672-11252-1-git-send-email-balajitk-l0cyMroinI0@public.gmane.org>
@ 2012-04-11  4:18 ` Rajendra Nayak
  2 siblings, 0 replies; 9+ messages in thread
From: Rajendra Nayak @ 2012-04-11  4:18 UTC (permalink / raw)
  To: Balaji T K; +Cc: robherring2, devicetree-discuss, linux-omap, cjb, bigeasy

On Tuesday 10 April 2012 08:41 PM, Balaji T K wrote:
> If of_have_populated_dt is called from module, build fails with "allnodes"
> undefined error, so remove inline and export of_have_populated_dt.

Thanks Balaji, for taking care of this while I was out.
But like Rob and Sebastian mentioned, looks like the usage of
of_have_populated_dt() itself is wrong in the first place.
So I will fix that up with a patch shortly.

>
> Signed-off-by: Balaji T K<balajitk@ti.com>
> ---
>   drivers/of/base.c  |    6 ++++++
>   include/linux/of.h |    6 +-----
>   2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 5806449..dc1af42 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -186,6 +186,12 @@ struct property *of_find_property(const struct device_node *np,
>   }
>   EXPORT_SYMBOL(of_find_property);
>
> +bool of_have_populated_dt(void)
> +{
> +	return allnodes != NULL;
> +}
> +EXPORT_SYMBOL(of_have_populated_dt);
> +
>   /**
>    * of_find_all_nodes - Get next node in global list
>    * @prev:	Previous node or NULL to start iteration
> diff --git a/include/linux/of.h b/include/linux/of.h
> index fa7fb1d..28e933e 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -92,11 +92,6 @@ extern struct device_node *of_chosen;
>   extern struct device_node *of_aliases;
>   extern rwlock_t devtree_lock;
>
> -static inline bool of_have_populated_dt(void)
> -{
> -	return allnodes != NULL;
> -}
> -
>   static inline bool of_node_is_root(const struct device_node *node)
>   {
>   	return node&&  (node->parent == NULL);
> @@ -112,6 +107,7 @@ static inline void of_node_set_flag(struct device_node *n, unsigned long flag)
>   	set_bit(flag,&n->_flags);
>   }
>
> +extern bool of_have_populated_dt(void);
>   extern struct device_node *of_find_all_nodes(struct device_node *prev);
>
>   /*


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

end of thread, other threads:[~2012-04-11  4:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-10 15:11 [RFC] dt: export of_have_populated_dt Balaji T K
2012-04-10 16:19 ` Cousson, Benoit
     [not found]   ` <4F845D99.7020705-l0cyMroinI0@public.gmane.org>
2012-04-10 16:21     ` Chris Ball
2012-04-10 16:29       ` Cousson, Benoit
2012-04-10 17:20         ` Rob Herring
2012-04-10 20:33           ` Grant Likely
2012-04-11  4:16           ` Rajendra Nayak
     [not found] ` <1334070672-11252-1-git-send-email-balajitk-l0cyMroinI0@public.gmane.org>
2012-04-10 17:36   ` Sebastian Andrzej Siewior
2012-04-11  4:18 ` Rajendra Nayak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).