[PATCH] of/irq: stub out public API
Rob Herring
robherring2 at gmail.com
Thu Nov 1 10:37:34 EST 2012
On 10/31/2012 04:09 PM, Jeffrey Hugo wrote:
> Restructure of_irq.h so that the public API is defined as function stubs
> when CONFIG_OF_IRQ is not defined. This allows client drivers to
> sucessfully compile in configurations where CONFIG_OF_IRQ is defined and
> in configurations where it is not defined.
>
Do you have an example of where you need this? For many of these drivers
should not be calling them directly as they are intended for core code.
Rob
> Signed-off-by: Jeffrey Hugo <jhugo at codeaurora.org>
> ---
> include/linux/of_irq.h | 71 +++++++++++++++++++++++++++++++++++------------
> 1 files changed, 53 insertions(+), 18 deletions(-)
>
> diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
> index 1717cd9..1b5771a 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
> @@ -57,7 +47,23 @@ static inline int of_irq_map_oldworld(struct device_node *device, int index,
> }
> #endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
>
> +#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);
> +#else /* !CONFIG_OF */
> +static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
> + int index)
> +{
> + return 0;
> +}
> +#endif /* !CONFIG_OF */
> +
>
> +#if defined(CONFIG_OF_IRQ)
> extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
> u32 ointsize, const u32 *addr,
> struct of_irq *out_irq);
> @@ -74,15 +80,44 @@ extern int of_irq_to_resource_table(struct device_node *dev,
> 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 */
> -
> -#else /* !CONFIG_OF */
> -static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
> - int index)
> +#else /* !CONFIG_OF_IRQ */
> +static inline int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
> + u32 ointsize, const u32 *addr,
> + struct of_irq *out_irq)
> {
> return 0;
> }
> -#endif /* !CONFIG_OF */
> -
> +static inline int of_irq_map_one(struct device_node *device, int index,
> + struct of_irq *out_irq)
> +{
> + return 0;
> +}
> +static inline unsigned int irq_create_of_mapping(struct device_node *controller,
> + const u32 *intspec,
> + unsigned int intsize)
> +{
> + return 0;
> +}
> +static inline int of_irq_to_resource(struct device_node *dev, int index,
> + struct resource *r)
> +{
> + return 0;
> +}
> +static inline int of_irq_count(struct device_node *dev)
> +{
> + return 0;
> +}
> +static inline int of_irq_to_resource_table(struct device_node *dev,
> + struct resource *res, int nr_irqs)
> +{
> + return 0;
> +}
> +static inline struct device_node *of_irq_find_parent(struct device_node *child)
> +{
> + return NULL;
> +}
> +static inline void of_irq_init(const struct of_device_id *matches)
> +{
> +}
> +#endif /* CONFIG_OF_IRQ */
> #endif /* __OF_IRQ_H */
>
More information about the devicetree-discuss
mailing list