* [PATCH 3.6.0] of: Add missing dummy functions @ 2012-10-17 10:26 Srinivas KANDAGATLA [not found] ` <1350469563-19345-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Srinivas KANDAGATLA @ 2012-10-17 10:26 UTC (permalink / raw) To: robherring2-Re5JQEeQqe8AvxtiuMwx3w, grant.likely-s3s/WqlpOiPyB63q8FvJNQ Cc: kgene.kim-Sze3O3UU22JBDgjK7y7TUQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, ben-linux-elnMNo+KYs3YtjvyW6yDsg From: Srinivas Kandagatla <srinivas.kandagatla-qxv4g6HH51o@public.gmane.org> Some functions in of.h have dummy functions and real implementations, however few of them have only real implementation. I think to be more consistent this patch adds below dummy functions if for non CONFIG_OF's. of_find_node_by_type of_device_is_available of_find_node_with_property of_find_matching_node of_find_node_by_path of_find_node_by_phandle of_get_parent of_get_next_parent of_get_next_child of_get_next_available_child of_get_child_by_name Hopefully this can eliminate the need to ifdef code in the drivers. Reported-by: Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla-qxv4g6HH51o@public.gmane.org> --- include/linux/of.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 61 insertions(+), 0 deletions(-) diff --git a/include/linux/of.h b/include/linux/of.h index 72843b7..51ca94a 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -323,6 +323,12 @@ static inline struct device_node *of_find_node_by_name(struct device_node *from, return NULL; } +static inline struct device_node *of_find_node_by_type(struct device_node *from, + const char *type) +{ + return NULL; +} + static inline bool of_have_populated_dt(void) { return false; @@ -342,6 +348,17 @@ static inline int of_device_is_compatible(const struct device_node *device, return 0; } +static inline int of_device_is_available(const struct device_node *device) +{ + return 0; +} + +static inline struct device_node *of_find_node_with_property( + struct device_node *from, const char *prop_name) +{ + return NULL; +} + static inline struct property *of_find_property(const struct device_node *np, const char *name, int *lenp) @@ -357,6 +374,50 @@ static inline struct device_node *of_find_compatible_node( return NULL; } +static inline struct device_node *of_find_matching_node( + struct device_node *from, const struct of_device_id *matches) +{ + return NULL; +} + +static inline struct device_node *of_find_node_by_path(const char *path) +{ + return NULL; +} + +static inline struct device_node *of_find_node_by_phandle(phandle handle) +{ + return NULL; +} + +static inline struct device_node *of_get_parent(const struct device_node *node) +{ + return NULL; +} + +static inline struct device_node *of_get_next_parent(struct device_node *node) +{ + return NULL; +} + +static inline struct device_node *of_get_next_child( + const struct device_node *node, struct device_node *prev) +{ + return NULL; +} + +static inline struct device_node *of_get_next_available_child( + const struct device_node *node, struct device_node *prev) +{ + return NULL; +} + +static inline struct device_node *of_get_child_by_name( + const struct device_node *node, const char *name) +{ + return NULL; +} + static inline int of_property_read_u32_array(const struct device_node *np, const char *propname, u32 *out_values, size_t sz) -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 3+ messages in thread
[parent not found: <1350469563-19345-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org>]
* Re: [PATCH 3.6.0] of: Add missing dummy functions [not found] ` <1350469563-19345-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org> @ 2012-10-17 21:32 ` Rob Herring [not found] ` <507F23F7.5070509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Rob Herring @ 2012-10-17 21:32 UTC (permalink / raw) To: Srinivas KANDAGATLA Cc: kgene.kim-Sze3O3UU22JBDgjK7y7TUQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, ben-linux-elnMNo+KYs3YtjvyW6yDsg On 10/17/2012 05:26 AM, Srinivas KANDAGATLA wrote: > From: Srinivas Kandagatla <srinivas.kandagatla-qxv4g6HH51o@public.gmane.org> > > Some functions in of.h have dummy functions and real implementations, > however few of them have only real implementation. > I think to be more consistent this patch adds below dummy functions if > for non CONFIG_OF's. > Fixing these up one by one has annoyed me, but I know Grant has generally resisted blindly creating empty functions. So I would like Grant's comments. I'm fine with these except the ones noted below. > of_find_node_by_type This should not be used except a few places as using device_type is generally only for true OF. > of_device_is_available > of_find_node_with_property Only used in 2 places. > of_find_matching_node > of_find_node_by_path > of_find_node_by_phandle > of_get_parent > of_get_next_parent > of_get_next_child > of_get_next_available_child > of_get_child_by_name Already have this one. > > Hopefully this can eliminate the need to ifdef code in the drivers. Sometimes we want that for drivers that can be built both for OF and !OF and you can't optimize away all the code and data. Rob > > Reported-by: Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> > Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla-qxv4g6HH51o@public.gmane.org> > --- > include/linux/of.h | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 61 insertions(+), 0 deletions(-) > > diff --git a/include/linux/of.h b/include/linux/of.h > index 72843b7..51ca94a 100644 > --- a/include/linux/of.h > +++ b/include/linux/of.h > @@ -323,6 +323,12 @@ static inline struct device_node *of_find_node_by_name(struct device_node *from, > return NULL; > } > > +static inline struct device_node *of_find_node_by_type(struct device_node *from, > + const char *type) > +{ > + return NULL; > +} > + > static inline bool of_have_populated_dt(void) > { > return false; > @@ -342,6 +348,17 @@ static inline int of_device_is_compatible(const struct device_node *device, > return 0; > } > > +static inline int of_device_is_available(const struct device_node *device) > +{ > + return 0; > +} > + > +static inline struct device_node *of_find_node_with_property( > + struct device_node *from, const char *prop_name) > +{ > + return NULL; > +} > + > static inline struct property *of_find_property(const struct device_node *np, > const char *name, > int *lenp) > @@ -357,6 +374,50 @@ static inline struct device_node *of_find_compatible_node( > return NULL; > } > > +static inline struct device_node *of_find_matching_node( > + struct device_node *from, const struct of_device_id *matches) > +{ > + return NULL; > +} > + > +static inline struct device_node *of_find_node_by_path(const char *path) > +{ > + return NULL; > +} > + > +static inline struct device_node *of_find_node_by_phandle(phandle handle) > +{ > + return NULL; > +} > + > +static inline struct device_node *of_get_parent(const struct device_node *node) > +{ > + return NULL; > +} > + > +static inline struct device_node *of_get_next_parent(struct device_node *node) > +{ > + return NULL; > +} > + > +static inline struct device_node *of_get_next_child( > + const struct device_node *node, struct device_node *prev) > +{ > + return NULL; > +} > + > +static inline struct device_node *of_get_next_available_child( > + const struct device_node *node, struct device_node *prev) > +{ > + return NULL; > +} > + > +static inline struct device_node *of_get_child_by_name( > + const struct device_node *node, const char *name) > +{ > + return NULL; > +} > + > static inline int of_property_read_u32_array(const struct device_node *np, > const char *propname, > u32 *out_values, size_t sz) > ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <507F23F7.5070509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH 3.6.0] of: Add missing dummy functions [not found] ` <507F23F7.5070509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> @ 2012-11-26 10:38 ` Grant Likely 0 siblings, 0 replies; 3+ messages in thread From: Grant Likely @ 2012-11-26 10:38 UTC (permalink / raw) To: Rob Herring, Srinivas KANDAGATLA Cc: kgene.kim-Sze3O3UU22JBDgjK7y7TUQ, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E, ben-linux-elnMNo+KYs3YtjvyW6yDsg On Wed, 17 Oct 2012 16:32:39 -0500, Rob Herring <robherring2-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > On 10/17/2012 05:26 AM, Srinivas KANDAGATLA wrote: > > From: Srinivas Kandagatla <srinivas.kandagatla-qxv4g6HH51o@public.gmane.org> > > > > Some functions in of.h have dummy functions and real implementations, > > however few of them have only real implementation. > > I think to be more consistent this patch adds below dummy functions if > > for non CONFIG_OF's. > > > > Fixing these up one by one has annoyed me, but I know Grant has > generally resisted blindly creating empty functions. So I would like > Grant's comments. I'm fine with these except the ones noted below. > > > of_find_node_by_type > > This should not be used except a few places as using device_type is > generally only for true OF. > > > of_device_is_available > > of_find_node_with_property > > Only used in 2 places. > > > of_find_matching_node > > of_find_node_by_path > > of_find_node_by_phandle > > of_get_parent > > of_get_next_parent > > of_get_next_child > > of_get_next_available_child > > of_get_child_by_name > > Already have this one. > > > > > Hopefully this can eliminate the need to ifdef code in the drivers. > > Sometimes we want that for drivers that can be built both for OF and !OF > and you can't optimize away all the code and data. Right. I've been cautious here for a reason. As much as possible I want to encourage of_* calls to be collected together in a driver, not scattered all over the place. Often the whole block of OF-aware code in a driver can be compiled out if it is grouped together into a function. Also, some of these only make sense in the context of an OF-aware code block and there is no sensible empty version. So, I'm fine with adding the empty versions on a case-by-case basis, but not wholesale. g. ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-26 10:38 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-10-17 10:26 [PATCH 3.6.0] of: Add missing dummy functions Srinivas KANDAGATLA [not found] ` <1350469563-19345-1-git-send-email-srinivas.kandagatla-qxv4g6HH51o@public.gmane.org> 2012-10-17 21:32 ` Rob Herring [not found] ` <507F23F7.5070509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 2012-11-26 10:38 ` Grant Likely
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).