devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/3] of/irq: fix guards and dummies for OF=y and OF_IRQ=n
@ 2015-10-12 12:43 Jonas Gorski
       [not found] ` <1444653804-25544-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Jonas Gorski @ 2015-10-12 12:43 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Rob Herring, Frank Rowand, Grant Likely, Marc Zyngier

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 moving of_msi_configure
to under the right guard and add a dummy implementation, make
of_irq_find_parent static as there are no external users, and make the
guard for irq_of_parse_and_map more specific.

Based on robh/linux.git#for-next, as the tree from MAINTAINERS haven't
been updated for a while. I hope that is the right git to use.

Changes v1 -> v2:
 * merge the of_msi_configure into one patch
 * make of_irq_find_parent static and remove the prototype/dummy
 * rebased onto robh/linux.git#for-next

Jonas Gorski (3):
  of/irq: move of_msi_configure to the right guard and add a dummy
  of/irq: make of_irq_find_parent static
  of/irq: fix guards for irq_of_parse_and_map prototype

 drivers/of/irq.c       |  2 +-
 include/linux/of_irq.h | 15 ++++++---------
 2 files changed, 7 insertions(+), 10 deletions(-)

-- 
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH V2 1/3] of/irq: move of_msi_configure to the right guard and add a dummy
       [not found] ` <1444653804-25544-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
@ 2015-10-12 12:43   ` Jonas Gorski
  2015-10-12 12:43   ` [PATCH V2 2/3] of/irq: make of_irq_find_parent static Jonas Gorski
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jonas Gorski @ 2015-10-12 12:43 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Rob Herring, Frank Rowand, Grant Likely, Marc Zyngier

of_msi_configure is part of of_irq.c, which is compiled in when OF_IRQ
is enabled, not just OF.
Also It is unconditionally called from of_platform_device_create_pdata,
which does not depend on OF_IRQ, just OF_ADDRESS, so we need a dummy
implementation in case of OF_ADDRESS=y but OF_IRQ=n.

Fixes: c706c239 ("of/platform: Assign MSI domain to platform device")
Signed-off-by: Jonas Gorski <jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
---
v1 -> v2:
 * fix both issues (guard and missing dummy) at once.

 include/linux/of_irq.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 4bcbd58..0088038 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -46,6 +46,7 @@ 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 void of_msi_configure(struct device *dev, struct device_node *np);
 #else
 static inline int of_irq_count(struct device_node *dev)
 {
@@ -64,6 +65,9 @@ static inline int of_irq_to_resource_table(struct device_node *dev,
 {
 	return 0;
 }
+static inline void of_msi_configure(struct device *dev, struct device_node *np)
+{
+}
 #endif
 
 #if defined(CONFIG_OF)
@@ -74,7 +78,6 @@ static inline int of_irq_to_resource_table(struct device_node *dev,
  */
 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);
-extern void of_msi_configure(struct device *dev, struct device_node *np);
 
 #else /* !CONFIG_OF */
 static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
-- 
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH V2 2/3] of/irq: make of_irq_find_parent static
       [not found] ` <1444653804-25544-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
  2015-10-12 12:43   ` [PATCH V2 1/3] of/irq: move of_msi_configure to the right guard and add a dummy Jonas Gorski
@ 2015-10-12 12:43   ` Jonas Gorski
  2015-10-12 12:43   ` [PATCH V2 3/3] of/irq: fix guards for irq_of_parse_and_map prototype Jonas Gorski
  2015-10-13 18:48   ` [PATCH V2 0/3] of/irq: fix guards and dummies for OF=y and OF_IRQ=n Rob Herring
  3 siblings, 0 replies; 5+ messages in thread
From: Jonas Gorski @ 2015-10-12 12:43 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Rob Herring, Frank Rowand, Grant Likely, Marc Zyngier

of_irq_find_parent has no users outside of of_irq.c, so it does not make
sense to expose it in of_irq.h. Therefore remove the prototype and dummy
implmeentation and make the function static instead.

Signed-off-by: Jonas Gorski <jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
---
v1 -> v2:
 * just drop the prototype and the dummy and make it static 

 drivers/of/irq.c       | 2 +-
 include/linux/of_irq.h | 6 ------
 2 files changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 55317fa..0c7f4cb 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -53,7 +53,7 @@ EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
  * Returns a pointer to the interrupt parent node, or NULL if the interrupt
  * parent could not be determined.
  */
-struct device_node *of_irq_find_parent(struct device_node *child)
+static struct device_node *of_irq_find_parent(struct device_node *child)
 {
 	struct device_node *p;
 	const __be32 *parp;
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index 0088038..a58e2e5 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -77,7 +77,6 @@ static inline void of_msi_configure(struct device *dev, struct device_node *np)
  * 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,
@@ -85,11 +84,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;
-}
 #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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH V2 3/3] of/irq: fix guards for irq_of_parse_and_map prototype
       [not found] ` <1444653804-25544-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
  2015-10-12 12:43   ` [PATCH V2 1/3] of/irq: move of_msi_configure to the right guard and add a dummy Jonas Gorski
  2015-10-12 12:43   ` [PATCH V2 2/3] of/irq: make of_irq_find_parent static Jonas Gorski
@ 2015-10-12 12:43   ` Jonas Gorski
  2015-10-13 18:48   ` [PATCH V2 0/3] of/irq: fix guards and dummies for OF=y and OF_IRQ=n Rob Herring
  3 siblings, 0 replies; 5+ messages in thread
From: Jonas Gorski @ 2015-10-12 12:43 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: Rob Herring, Frank Rowand, Grant Likely, Marc Zyngier

Since 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

Signed-off-by: Jonas Gorski <jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
---
v1 -> v2:
 * no changes

 include/linux/of_irq.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index a58e2e5..580818d 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -70,7 +70,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,
@@ -78,7 +78,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)
 {
-- 
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH V2 0/3] of/irq: fix guards and dummies for OF=y and OF_IRQ=n
       [not found] ` <1444653804-25544-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2015-10-12 12:43   ` [PATCH V2 3/3] of/irq: fix guards for irq_of_parse_and_map prototype Jonas Gorski
@ 2015-10-13 18:48   ` Rob Herring
  3 siblings, 0 replies; 5+ messages in thread
From: Rob Herring @ 2015-10-13 18:48 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Frank Rowand,
	Grant Likely, Marc Zyngier

On Mon, Oct 12, 2015 at 7:43 AM, Jonas Gorski <jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org> wrote:
> 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 moving of_msi_configure
> to under the right guard and add a dummy implementation, make
> of_irq_find_parent static as there are no external users, and make the
> guard for irq_of_parse_and_map more specific.
>
> Based on robh/linux.git#for-next, as the tree from MAINTAINERS haven't
> been updated for a while. I hope that is the right git to use.
>
> Changes v1 -> v2:
>  * merge the of_msi_configure into one patch
>  * make of_irq_find_parent static and remove the prototype/dummy
>  * rebased onto robh/linux.git#for-next
>
> Jonas Gorski (3):
>   of/irq: move of_msi_configure to the right guard and add a dummy
>   of/irq: make of_irq_find_parent static
>   of/irq: fix guards for irq_of_parse_and_map prototype
>
>  drivers/of/irq.c       |  2 +-
>  include/linux/of_irq.h | 15 ++++++---------
>  2 files changed, 7 insertions(+), 10 deletions(-)

Series applied, thanks.

Rob

>
> --
> 2.1.4
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-10-13 18:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-12 12:43 [PATCH V2 0/3] of/irq: fix guards and dummies for OF=y and OF_IRQ=n Jonas Gorski
     [not found] ` <1444653804-25544-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>
2015-10-12 12:43   ` [PATCH V2 1/3] of/irq: move of_msi_configure to the right guard and add a dummy Jonas Gorski
2015-10-12 12:43   ` [PATCH V2 2/3] of/irq: make of_irq_find_parent static Jonas Gorski
2015-10-12 12:43   ` [PATCH V2 3/3] of/irq: fix guards for irq_of_parse_and_map prototype Jonas Gorski
2015-10-13 18:48   ` [PATCH V2 0/3] of/irq: fix guards and dummies for OF=y and OF_IRQ=n Rob Herring

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