devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] of: clean-up ifdefs in of_irq.h
@ 2013-09-05 18:06 Rob Herring
  2013-09-05 19:29 ` Randy Dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: Rob Herring @ 2013-09-05 18:06 UTC (permalink / raw)
  To: devicetree, linux-kernel; +Cc: Randy Dunlap, Rob Herring, Grant Likely

From: Rob Herring <rob.herring@calxeda.com>

Much of of_irq.h is needlessly ifdef'ed. Clean this up and minimize the
amount ifdef'ed code. This fixes some  build warnings when CONFIG_OF
is not enabled (seen on i386 and x86_64):

include/linux/of_irq.h:82:7: warning: 'struct device_node' declared inside parameter list [enabled by default]
include/linux/of_irq.h:82:7: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
include/linux/of_irq.h:87:47: warning: 'struct device_node' declared inside parameter list [enabled by default]

Compile tested on i386, sparc and arm.

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Grant Likely <grant.likely@linaro.org>
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
Randy,

After looking at this some more, I think it makes sense to just
fix these needless ifdefs now and be done with it.

Rob

 include/linux/of_irq.h | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 535cecf..fcd63ba 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -1,8 +1,6 @@
 #ifndef __OF_IRQ_H
 #define __OF_IRQ_H
 
-#if defined(CONFIG_OF)
-struct of_irq;
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/irq.h>
@@ -10,14 +8,6 @@ struct of_irq;
 #include <linux/ioport.h>
 #include <linux/of.h>
 
-/*
- * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
- * implements it differently.  However, the prototype is the same for all,
- * so declare it here regardless of the CONFIG_OF_IRQ setting.
- */
-extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
-
-#if defined(CONFIG_OF_IRQ)
 /**
  * of_irq - container for device_node/irq_specifier pair for an irq controller
  * @controller: pointer to interrupt controller device tree node
@@ -71,11 +61,17 @@ extern int of_irq_to_resource(struct device_node *dev, int index,
 extern int of_irq_count(struct device_node *dev);
 extern int of_irq_to_resource_table(struct device_node *dev,
 		struct resource *res, int nr_irqs);
-extern struct device_node *of_irq_find_parent(struct device_node *child);
 
 extern void of_irq_init(const struct of_device_id *matches);
 
-#endif /* CONFIG_OF_IRQ */
+#if defined(CONFIG_OF)
+/*
+ * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
+ * implements it differently.  However, the prototype is the same for all,
+ * so declare it here regardless of the CONFIG_OF_IRQ setting.
+ */
+extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
+extern struct device_node *of_irq_find_parent(struct device_node *child);
 
 #else /* !CONFIG_OF */
 static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
-- 
1.8.1.2

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

* Re: [PATCH] of: clean-up ifdefs in of_irq.h
  2013-09-05 18:06 [PATCH] of: clean-up ifdefs in of_irq.h Rob Herring
@ 2013-09-05 19:29 ` Randy Dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: Randy Dunlap @ 2013-09-05 19:29 UTC (permalink / raw)
  To: Rob Herring; +Cc: devicetree, linux-kernel, Rob Herring, Grant Likely

On 09/05/13 11:06, Rob Herring wrote:
> From: Rob Herring <rob.herring@calxeda.com>
> 
> Much of of_irq.h is needlessly ifdef'ed. Clean this up and minimize the
> amount ifdef'ed code. This fixes some  build warnings when CONFIG_OF
> is not enabled (seen on i386 and x86_64):
> 
> include/linux/of_irq.h:82:7: warning: 'struct device_node' declared inside parameter list [enabled by default]
> include/linux/of_irq.h:82:7: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
> include/linux/of_irq.h:87:47: warning: 'struct device_node' declared inside parameter list [enabled by default]
> 
> Compile tested on i386, sparc and arm.
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Grant Likely <grant.likely@linaro.org>
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>
> ---
> Randy,
> 
> After looking at this some more, I think it makes sense to just
> fix these needless ifdefs now and be done with it.

OK, thanks for the patch.


> 
> Rob
> 
>  include/linux/of_irq.h | 20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
> index 535cecf..fcd63ba 100644
> --- a/include/linux/of_irq.h
> +++ b/include/linux/of_irq.h
> @@ -1,8 +1,6 @@
>  #ifndef __OF_IRQ_H
>  #define __OF_IRQ_H
>  
> -#if defined(CONFIG_OF)
> -struct of_irq;
>  #include <linux/types.h>
>  #include <linux/errno.h>
>  #include <linux/irq.h>
> @@ -10,14 +8,6 @@ struct of_irq;
>  #include <linux/ioport.h>
>  #include <linux/of.h>
>  
> -/*
> - * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
> - * implements it differently.  However, the prototype is the same for all,
> - * so declare it here regardless of the CONFIG_OF_IRQ setting.
> - */
> -extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
> -
> -#if defined(CONFIG_OF_IRQ)
>  /**
>   * of_irq - container for device_node/irq_specifier pair for an irq controller
>   * @controller: pointer to interrupt controller device tree node
> @@ -71,11 +61,17 @@ extern int of_irq_to_resource(struct device_node *dev, int index,
>  extern int of_irq_count(struct device_node *dev);
>  extern int of_irq_to_resource_table(struct device_node *dev,
>  		struct resource *res, int nr_irqs);
> -extern struct device_node *of_irq_find_parent(struct device_node *child);
>  
>  extern void of_irq_init(const struct of_device_id *matches);
>  
> -#endif /* CONFIG_OF_IRQ */
> +#if defined(CONFIG_OF)
> +/*
> + * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
> + * implements it differently.  However, the prototype is the same for all,
> + * so declare it here regardless of the CONFIG_OF_IRQ setting.
> + */
> +extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
> +extern struct device_node *of_irq_find_parent(struct device_node *child);
>  
>  #else /* !CONFIG_OF */
>  static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
> 


-- 
~Randy

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

end of thread, other threads:[~2013-09-05 19:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-05 18:06 [PATCH] of: clean-up ifdefs in of_irq.h Rob Herring
2013-09-05 19:29 ` Randy Dunlap

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