* [PATCH] of: introduce of_get_available_child_count @ 2013-09-24 17:50 Bryan Wu [not found] ` <1380045009-21149-1-git-send-email-cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Bryan Wu @ 2013-09-24 17:50 UTC (permalink / raw) To: grant.likely-QSEj5FYQhm4dnm+yROfE0A, rob.herring-bsGFqQB8/DxBDgjK7y7TUQ, devicetree-u79uwXL29TY76Z2rM5mHXA, josh.wu-AIFe0yeh4nAAvxtiuMwx3w, cooloney-Re5JQEeQqe8AvxtiuMwx3w Some drivers keep counting available child by themselves. So introduce a new simple API like of_get_child_count() but for available childs. Cc: Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> Signed-off-by: Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> --- include/linux/of.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/linux/of.h b/include/linux/of.h index f95aee3..54c2560 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -226,6 +226,17 @@ static inline int of_get_child_count(const struct device_node *np) return num; } +static inline int of_get_available_child_count(const struct device_node *np) +{ + struct device_node *child; + int num = 0; + + for_each_available_child_of_node(np, child) + num++; + + return num; +} + extern struct device_node *of_find_node_with_property( struct device_node *from, const char *prop_name); #define for_each_node_with_property(dn, prop_name) \ @@ -376,6 +387,11 @@ static inline int of_get_child_count(const struct device_node *np) return 0; } +static inline int of_get_available_child_count(const struct device_node *np) +{ + return 0; +} + static inline int of_device_is_compatible(const struct device_node *device, const char *name) { -- 1.8.1.5 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply related [flat|nested] 6+ messages in thread
[parent not found: <1380045009-21149-1-git-send-email-cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] of: introduce of_get_available_child_count [not found] ` <1380045009-21149-1-git-send-email-cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2013-09-24 21:16 ` Rob Herring [not found] ` <52420118.9050501-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Rob Herring @ 2013-09-24 21:16 UTC (permalink / raw) To: Bryan Wu Cc: grant.likely-QSEj5FYQhm4dnm+yROfE0A, devicetree-u79uwXL29TY76Z2rM5mHXA, josh.wu-AIFe0yeh4nAAvxtiuMwx3w On 09/24/2013 12:50 PM, Bryan Wu wrote: > Some drivers keep counting available child by themselves. So > introduce a new simple API like of_get_child_count() but for > available childs. > > Cc: Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> > Signed-off-by: Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > --- Acked-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> I assume you have some user and will take this dependency thru that tree? > include/linux/of.h | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/include/linux/of.h b/include/linux/of.h > index f95aee3..54c2560 100644 > --- a/include/linux/of.h > +++ b/include/linux/of.h > @@ -226,6 +226,17 @@ static inline int of_get_child_count(const struct device_node *np) > return num; > } > > +static inline int of_get_available_child_count(const struct device_node *np) > +{ > + struct device_node *child; > + int num = 0; > + > + for_each_available_child_of_node(np, child) > + num++; > + > + return num; > +} > + > extern struct device_node *of_find_node_with_property( > struct device_node *from, const char *prop_name); > #define for_each_node_with_property(dn, prop_name) \ > @@ -376,6 +387,11 @@ static inline int of_get_child_count(const struct device_node *np) > return 0; > } > > +static inline int of_get_available_child_count(const struct device_node *np) > +{ > + return 0; > +} > + > static inline int of_device_is_compatible(const struct device_node *device, > const char *name) > { > -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <52420118.9050501-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] of: introduce of_get_available_child_count [not found] ` <52420118.9050501-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2013-09-24 21:22 ` Bryan Wu [not found] ` <CAK5ve-LbgMrD1SFqpaW-L2cmEahaA9Ff+wjrrxwJiG=cVkQrrg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Bryan Wu @ 2013-09-24 21:22 UTC (permalink / raw) To: Rob Herring Cc: Grant Likely, devicetree-u79uwXL29TY76Z2rM5mHXA, josh.wu-AIFe0yeh4nAAvxtiuMwx3w On Tue, Sep 24, 2013 at 2:16 PM, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > On 09/24/2013 12:50 PM, Bryan Wu wrote: >> Some drivers keep counting available child by themselves. So >> introduce a new simple API like of_get_child_count() but for >> available childs. >> >> Cc: Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> >> Signed-off-by: Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> --- > > Acked-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > > I assume you have some user and will take this dependency thru that tree? > Exactly, a patch from Josh [1] inspired me to create this API. Thanks, -Bryan [1]: https://lkml.org/lkml/2013/9/24/68 >> include/linux/of.h | 16 ++++++++++++++++ >> 1 file changed, 16 insertions(+) >> >> diff --git a/include/linux/of.h b/include/linux/of.h >> index f95aee3..54c2560 100644 >> --- a/include/linux/of.h >> +++ b/include/linux/of.h >> @@ -226,6 +226,17 @@ static inline int of_get_child_count(const struct device_node *np) >> return num; >> } >> >> +static inline int of_get_available_child_count(const struct device_node *np) >> +{ >> + struct device_node *child; >> + int num = 0; >> + >> + for_each_available_child_of_node(np, child) >> + num++; >> + >> + return num; >> +} >> + >> extern struct device_node *of_find_node_with_property( >> struct device_node *from, const char *prop_name); >> #define for_each_node_with_property(dn, prop_name) \ >> @@ -376,6 +387,11 @@ static inline int of_get_child_count(const struct device_node *np) >> return 0; >> } >> >> +static inline int of_get_available_child_count(const struct device_node *np) >> +{ >> + return 0; >> +} >> + >> static inline int of_device_is_compatible(const struct device_node *device, >> const char *name) >> { >> > -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAK5ve-LbgMrD1SFqpaW-L2cmEahaA9Ff+wjrrxwJiG=cVkQrrg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] of: introduce of_get_available_child_count [not found] ` <CAK5ve-LbgMrD1SFqpaW-L2cmEahaA9Ff+wjrrxwJiG=cVkQrrg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-10-24 18:09 ` Bryan Wu [not found] ` <CAK5ve-+8ySa3gi8smSo88Sq2RCNFRMuB-hSYLs0CYBtkiaG-bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Bryan Wu @ 2013-10-24 18:09 UTC (permalink / raw) To: Rob Herring Cc: Grant Likely, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Josh Wu On Tue, Sep 24, 2013 at 2:22 PM, Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > On Tue, Sep 24, 2013 at 2:16 PM, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> On 09/24/2013 12:50 PM, Bryan Wu wrote: >>> Some drivers keep counting available child by themselves. So >>> introduce a new simple API like of_get_child_count() but for >>> available childs. >>> >>> Cc: Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> >>> Signed-off-by: Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >>> --- >> >> Acked-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> >> Will this patch be merged through you guys or need I take care of it? Thanks, -Bryan >> I assume you have some user and will take this dependency thru that tree? >> > > Exactly, a patch from Josh [1] inspired me to create this API. > > Thanks, > -Bryan > > [1]: https://lkml.org/lkml/2013/9/24/68 > > >>> include/linux/of.h | 16 ++++++++++++++++ >>> 1 file changed, 16 insertions(+) >>> >>> diff --git a/include/linux/of.h b/include/linux/of.h >>> index f95aee3..54c2560 100644 >>> --- a/include/linux/of.h >>> +++ b/include/linux/of.h >>> @@ -226,6 +226,17 @@ static inline int of_get_child_count(const struct device_node *np) >>> return num; >>> } >>> >>> +static inline int of_get_available_child_count(const struct device_node *np) >>> +{ >>> + struct device_node *child; >>> + int num = 0; >>> + >>> + for_each_available_child_of_node(np, child) >>> + num++; >>> + >>> + return num; >>> +} >>> + >>> extern struct device_node *of_find_node_with_property( >>> struct device_node *from, const char *prop_name); >>> #define for_each_node_with_property(dn, prop_name) \ >>> @@ -376,6 +387,11 @@ static inline int of_get_child_count(const struct device_node *np) >>> return 0; >>> } >>> >>> +static inline int of_get_available_child_count(const struct device_node *np) >>> +{ >>> + return 0; >>> +} >>> + >>> static inline int of_device_is_compatible(const struct device_node *device, >>> const char *name) >>> { >>> >> -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <CAK5ve-+8ySa3gi8smSo88Sq2RCNFRMuB-hSYLs0CYBtkiaG-bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: [PATCH] of: introduce of_get_available_child_count [not found] ` <CAK5ve-+8ySa3gi8smSo88Sq2RCNFRMuB-hSYLs0CYBtkiaG-bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2013-10-25 0:02 ` Grant Likely [not found] ` <20131025000225.6E449C403B6-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org> 0 siblings, 1 reply; 6+ messages in thread From: Grant Likely @ 2013-10-25 0:02 UTC (permalink / raw) To: Bryan Wu, Rob Herring Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Josh Wu On Thu, 24 Oct 2013 11:09:54 -0700, Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > On Tue, Sep 24, 2013 at 2:22 PM, Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On Tue, Sep 24, 2013 at 2:16 PM, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> On 09/24/2013 12:50 PM, Bryan Wu wrote: > >>> Some drivers keep counting available child by themselves. So > >>> introduce a new simple API like of_get_child_count() but for > >>> available childs. > >>> > >>> Cc: Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> > >>> Signed-off-by: Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > >>> --- > >> > >> Acked-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> > >> > > Will this patch be merged through you guys or need I take care of it? Merge it with the patch that needs it. g. -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <20131025000225.6E449C403B6-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org>]
* Re: [PATCH] of: introduce of_get_available_child_count [not found] ` <20131025000225.6E449C403B6-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org> @ 2013-10-25 0:04 ` Bryan Wu 0 siblings, 0 replies; 6+ messages in thread From: Bryan Wu @ 2013-10-25 0:04 UTC (permalink / raw) To: Grant Likely Cc: Rob Herring, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Josh Wu On Thu, Oct 24, 2013 at 5:02 PM, Grant Likely <grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote: > On Thu, 24 Oct 2013 11:09:54 -0700, Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> On Tue, Sep 24, 2013 at 2:22 PM, Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > On Tue, Sep 24, 2013 at 2:16 PM, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> >> On 09/24/2013 12:50 PM, Bryan Wu wrote: >> >>> Some drivers keep counting available child by themselves. So >> >>> introduce a new simple API like of_get_child_count() but for >> >>> available childs. >> >>> >> >>> Cc: Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> >> >>> Signed-off-by: Bryan Wu <cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> >>> --- >> >> >> >> Acked-by: Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org> >> >> >> >> Will this patch be merged through you guys or need I take care of it? > > Merge it with the patch that needs it. > OK, I will do that. -Bryan -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-10-25 0:04 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-09-24 17:50 [PATCH] of: introduce of_get_available_child_count Bryan Wu [not found] ` <1380045009-21149-1-git-send-email-cooloney-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2013-09-24 21:16 ` Rob Herring [not found] ` <52420118.9050501-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2013-09-24 21:22 ` Bryan Wu [not found] ` <CAK5ve-LbgMrD1SFqpaW-L2cmEahaA9Ff+wjrrxwJiG=cVkQrrg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-10-24 18:09 ` Bryan Wu [not found] ` <CAK5ve-+8ySa3gi8smSo88Sq2RCNFRMuB-hSYLs0CYBtkiaG-bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2013-10-25 0:02 ` Grant Likely [not found] ` <20131025000225.6E449C403B6-WNowdnHR2B42iJbIjFUEsiwD8/FfD2ys@public.gmane.org> 2013-10-25 0:04 ` Bryan Wu
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).