LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] staging:board: fix build errors and warnings
@ 2014-12-08 17:24 Tsung-Han Lin
  2014-12-12 11:36 ` Grant Likely
  0 siblings, 1 reply; 3+ messages in thread
From: Tsung-Han Lin @ 2014-12-08 17:24 UTC (permalink / raw)
  To: gregkh
  Cc: grant.likely, robh+dt, horms+renesas, damm+renesas, devel,
	linux-kernel, devicetree

Add dummy implementation of 'of_find_all_nodes',
and remove the unnecessary 'of_can_translate_address',
which is already removed in commit
d9c6866be8a145e32da616d8dcbae806032d75b5 ("of: kill off
of_can_translate_address"), to fix the build errors and warnings
found by sparse.

Signed-off-by: Tsung-Han Lin <tsunghan.tw@gmail.com>
---
 drivers/staging/board/board.c | 3 +--
 include/linux/of.h            | 5 +++++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c
index 6050fbdfd31f..d5a6abc84519 100644
--- a/drivers/staging/board/board.c
+++ b/drivers/staging/board/board.c
@@ -11,8 +11,7 @@ static bool find_by_address(u64 base_address)
 	struct resource res;
 
 	while (dn) {
-		if (of_can_translate_address(dn)
-		    && !of_address_to_resource(dn, 0, &res)) {
+		if (!of_address_to_resource(dn, 0, &res)) {
 			if (res.start == base_address) {
 				of_node_put(dn);
 				return true;
diff --git a/include/linux/of.h b/include/linux/of.h
index dfde07e77a63..c2c5021c1ee4 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -616,6 +616,11 @@ static inline const char *of_prop_next_string(struct property *prop,
 	return NULL;
 }
 
+static inline struct device_node *of_find_all_nodes(struct device_node *prev)
+{
+	return NULL;
+}
+
 #define of_match_ptr(_ptr)	NULL
 #define of_match_node(_matches, _node)	NULL
 #endif /* CONFIG_OF */
-- 
2.1.0


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

* Re: [PATCH] staging:board: fix build errors and warnings
  2014-12-08 17:24 [PATCH] staging:board: fix build errors and warnings Tsung-Han Lin
@ 2014-12-12 11:36 ` Grant Likely
  2014-12-17 18:07   ` Tsung-Han Lin
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Likely @ 2014-12-12 11:36 UTC (permalink / raw)
  To: Tsung-Han Lin, gregkh
  Cc: robh+dt, horms+renesas, damm+renesas, devel, linux-kernel, devicetree

On Tue,  9 Dec 2014 01:24:09 +0800
, Tsung-Han Lin <tsunghan.tw@gmail.com>
 wrote:
> Add dummy implementation of 'of_find_all_nodes',
> and remove the unnecessary 'of_can_translate_address',
> which is already removed in commit
> d9c6866be8a145e32da616d8dcbae806032d75b5 ("of: kill off
> of_can_translate_address"), to fix the build errors and warnings
> found by sparse.
> 
> Signed-off-by: Tsung-Han Lin <tsunghan.tw@gmail.com>

???

This code is just weird. If CONFIG_OF is not enabled, then board.c
shouldn't be compiled at all. You can do this with a patch to the
Kconfig and Makefile. Also, if the functions in
drivers/staging/board/board.c are needed for driver support, then please
propose a patch that moves them in into drivers/of/base.c so that they
can be reviewed properly. They are so short and simple that fixing them
up as part of the normal review process should be sufficient.

As for fixing the compile error, please drop the change to
include/linux/of.h and resubmit.

g.


> ---
>  drivers/staging/board/board.c | 3 +--
>  include/linux/of.h            | 5 +++++
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/board/board.c b/drivers/staging/board/board.c
> index 6050fbdfd31f..d5a6abc84519 100644
> --- a/drivers/staging/board/board.c
> +++ b/drivers/staging/board/board.c
> @@ -11,8 +11,7 @@ static bool find_by_address(u64 base_address)
>  	struct resource res;
>  
>  	while (dn) {
> -		if (of_can_translate_address(dn)
> -		    && !of_address_to_resource(dn, 0, &res)) {
> +		if (!of_address_to_resource(dn, 0, &res)) {
>  			if (res.start == base_address) {
>  				of_node_put(dn);
>  				return true;
> diff --git a/include/linux/of.h b/include/linux/of.h
> index dfde07e77a63..c2c5021c1ee4 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -616,6 +616,11 @@ static inline const char *of_prop_next_string(struct property *prop,
>  	return NULL;
>  }
>  
> +static inline struct device_node *of_find_all_nodes(struct device_node *prev)
> +{
> +	return NULL;
> +}
> +
>  #define of_match_ptr(_ptr)	NULL
>  #define of_match_node(_matches, _node)	NULL
>  #endif /* CONFIG_OF */
> -- 
> 2.1.0
> 


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

* Re: [PATCH] staging:board: fix build errors and warnings
  2014-12-12 11:36 ` Grant Likely
@ 2014-12-17 18:07   ` Tsung-Han Lin
  0 siblings, 0 replies; 3+ messages in thread
From: Tsung-Han Lin @ 2014-12-17 18:07 UTC (permalink / raw)
  To: Grant Likely; +Cc: linux-kernel

On Fri, Dec 12, 2014 at 11:36:10AM +0000, Grant Likely wrote:
> On Tue,  9 Dec 2014 01:24:09 +0800
> , Tsung-Han Lin <tsunghan.tw@gmail.com>
>  wrote:
> > Add dummy implementation of 'of_find_all_nodes',
> > and remove the unnecessary 'of_can_translate_address',
> > which is already removed in commit
> > d9c6866be8a145e32da616d8dcbae806032d75b5 ("of: kill off
> > of_can_translate_address"), to fix the build errors and warnings
> > found by sparse.
> > 
> > Signed-off-by: Tsung-Han Lin <tsunghan.tw@gmail.com>
> 
> ???
> 
> This code is just weird. If CONFIG_OF is not enabled, then board.c
> shouldn't be compiled at all. You can do this with a patch to the
> Kconfig and Makefile. Also, if the functions in
> drivers/staging/board/board.c are needed for driver support, then please
> propose a patch that moves them in into drivers/of/base.c so that they
> can be reviewed properly. They are so short and simple that fixing them
> up as part of the normal review process should be sufficient.
> 
> As for fixing the compile error, please drop the change to
> include/linux/of.h and resubmit.
> 
> g.
> 
> 

Sorry it took me sometime to understand what I got wrong,
and thank you for your suggestion.
I will re-send a fix for this.

I just built those codes with wrong .config and options.

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

end of thread, other threads:[~2014-12-17 18:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-08 17:24 [PATCH] staging:board: fix build errors and warnings Tsung-Han Lin
2014-12-12 11:36 ` Grant Likely
2014-12-17 18:07   ` Tsung-Han Lin

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