of/irq: fix guards and dummies for OF=y and OF_IRQ=n
cover of/irq: fix guards and dummies for OF=y and OF_IRQ=n
Historically OF was only selectable by arch code, which usually also used IRQ_DOMAIN, thus making OF_IRQ and OF interchangeable for !SPARC.
Since OF is now a user selectable symbol, it is now easy to create a situation where OF=y and OF_IRQ=n, by not enabling IRQ_DOMAIN on e.g. x86.
This causes linking errors as for a few functions the prototype guard was OF, which is too broad and does not catch all combinations. Recently added of_msi_configure is even missing a dummy implementation.
The following three patches fix these issues by shuffling the prototypes and dummy implementations around (adding one where necessary), and make the guard for irq_of_parse_and_map more specific.
Based on devicetree/next.
Jonas Gorski (3):
of/irq: add a dummy of_msi_configure if OF_IRQ=n of/irq: fix guards of of_irq_find_parent and of_msi_configure of/irq: fix guards for irq_of_parse_and_map prototype
include/linux/of_irq.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
Signature · 5 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1441629437-23769-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org
PATCH 1/3 of/irq: add a dummy of_msi_configure if OF_IRQ=n
It is unconditionally called from of_platform_device_create_pdata, which does not depend on OF_IRQ, just OF_ADDRESS.
--- include/linux/of_irq.h | 4 ++++ 1 file changed, 4 insertions(+)
include/linux/of_irq.h +4 -0
@@ -86,6 +86,10 @@ static inline void *of_irq_find_parent(struct device_node *child) {return NULL ; } + +static inline void of_msi_configure (struct device *dev,struct device_node *np) +{ +}#endif /* !CONFIG_OF */ #endif /* __OF_IRQ_H */
Signature · 5 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1441629437-23769-2-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org
Re: [PATCH 1/3] of/irq: add a dummy of_msi_configure if OF_IRQ=n
Quoted 14 lines · Jonas Gorski
It is unconditionally called from
of_platform_device_create_pdata, which does not depend onOF_IRQ, justOF_ADDRESS.Fixes c706c239 ("of/platform: Assign MSI domain to platform device")Signed-off-by Jonas Gorski <[email protected]>--- include/linux/of_irq.h | 4 ++++ 1 file changed, 4 insertions(+)include/linux/of_irq.h +0
-0
include/linux/of_irq.h static inline void *of_irq_find_parent(struct device_node *child) · line 92
Quoted 7 lines
include/linux/of_irq.h +4
-0@@ -86,6 +86,10 @@ static inline void *of_irq_find_parent(struct device_node *child) {return NULL ; } + +static inline void of_msi_configure (struct device *dev,struct device_node *np) +{ +}
Why do you add it here and then move it in patch #2? Just do this in 1 patch.
Rob
Quoted 5 lines
include/linux/of_irq.h +0
-1#endif /* !CONFIG_OF */ #endif /* __OF_IRQ_H */ --2.1.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/3 of/irq: fix guards of of_irq_find_parent and of_msi_configure
In reply to a message not in the archiveOnly irq_of_parse_and_map is implemented differently on SPARC, so only that one should be protected by the CONFIG_OF guard.
--- include/linux/of_irq.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
include/linux/of_irq.h +9 -10
@@ -46,6 +46,8 @@ extern int of_irq_get(struct device_node *dev, int index);extern int of_irq_get_byname (struct device_node *dev,const char *name);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_msi_configure (struct device *dev,struct device_node *np);#else static inline int of_irq_count (struct device_node *dev) {
@@ -64,6 +66,13 @@ static inline int of_irq_to_resource_table(struct device_node *dev, {return 0 ; } +static inline void *of_irq_find_parent (struct device_node *child) +{ +return NULL ; +} +static inline void of_msi_configure (struct device *dev,struct device_node *np) +{ +}#endif #if defined(CONFIG_OF )
@@ -73,7 +82,6 @@ static inline int of_irq_to_resource_table(struct device_node *dev,* 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,
@@ -81,15 +89,6 @@ static inline unsigned int irq_of_parse_and_map(struct device_node *dev, {return 0 ; } - -static inline void *of_irq_find_parent (struct device_node *child) -{ -return NULL ; -} - -static inline void of_msi_configure (struct device *dev,struct device_node *np) -{ -}#endif /* !CONFIG_OF */ #endif /* __OF_IRQ_H */
Signature · 5 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1441629437-23769-3-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org
Re: [PATCH 2/3] of/irq: fix guards of of_irq_find_parent and of_msi_configure
Quoted 2 lines · Jonas Gorski
Only
irq_of_parse_and_mapis implemented differently on SPARC, so only that one should be protected by theCONFIG_OFguard.
of_irq_find_parent is only used by of_irq.c, so just make it static.
Rob
Quoted 58 lines
Signed-off-by Jonas Gorski <[email protected]>--- include/linux/of_irq.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)include/linux/of_irq.h +9
-11@@ -46,6 +46,8 @@ extern int of_irq_get(struct device_node *dev, int index);extern int of_irq_get_byname (struct device_node *dev,const char *name);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_msi_configure (struct device *dev,struct device_node *np);#else static inline int of_irq_count (struct device_node *dev) {@@ -64,6 +66,13 @@ static inline int of_irq_to_resource_table(struct device_node *dev, {return 0 ; } +static inline void *of_irq_find_parent (struct device_node *child) +{ +return NULL ; +} +static inline void of_msi_configure (struct device *dev,struct device_node *np) +{ +}#endif #if defined(CONFIG_OF )@@ -73,7 +82,6 @@ static inline int of_irq_to_resource_table(struct device_node *dev,* 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,@@ -81,15 +89,6 @@ static inline unsigned int irq_of_parse_and_map(struct device_node *dev, {return 0 ; } - -static inline void *of_irq_find_parent (struct device_node *child) -{ -return NULL ; -} - -static inline void of_msi_configure (struct device *dev,struct device_node *np) -{ -}#endif /* !CONFIG_OF */ #endif /* __OF_IRQ_H */ --
Quoted 1 line
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/3 of/irq: fix guards for irq_of_parse_and_map prototype
In reply to a message not in the archiveSince OF is now a userselectable config symbol, having OF=y but OF_IRQ=n is a valid combination for non-OF platforms, and OF=y does not guarantee anymore that OF_IRQ is enabled (or we are building for SPARC).
Fixes the following build error with OF=y, IRQ_DOMAIN=n and SPI=y:
drivers/built-in.o: In function `spi_register_master':
(.text+0xc3ae): undefined reference to `irq_of_parse_and_map' Makefile:935: recipe for target 'vmlinux' failed
make: *** [vmlinux] Error 1
--- include/linux/of_irq.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/linux/of_irq.h +2 -2
@@ -75,7 +75,7 @@ static inline void of_msi_configure(struct device *dev, struct device_node *np) }#endif -#if defined(CONFIG_OF ) +#if defined(CONFIG_OF_IRQ ) || defined(CONFIG_SPARC )/* * 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,
@@ -83,7 +83,7 @@ static inline void of_msi_configure(struct device *dev, struct device_node *np)*/ extern unsigned int irq_of_parse_and_map (struct device_node *node,int index); -#else /* !CONFIG_OF */ +#else /* !CONFIG_OF && !CONFIG_SPARC */ static inline unsigned int irq_of_parse_and_map (struct device_node *dev,int index) {
Signature · 5 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html