devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeffrey Hugo <jhugo@codeaurora.org>
To: grant.likely@secretlab.ca, rob.herring@calxeda.com
Cc: devicetree-discuss@lists.ozlabs.org,
	linux-arm-msm@vger.kernel.org,
	Jeffrey Hugo <jhugo@codeaurora.org>
Subject: [PATCH] of/irq: stub out public API
Date: Wed, 31 Oct 2012 15:09:25 -0600	[thread overview]
Message-ID: <1351717765-29395-1-git-send-email-jhugo@codeaurora.org> (raw)

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.

Signed-off-by: Jeffrey Hugo <jhugo@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 */
-- 
The Qualcomm Innovation Center, Inc is a member of Code Aurora Forum,
hosted by The Linux Foundation

             reply	other threads:[~2012-10-31 21:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-31 21:09 Jeffrey Hugo [this message]
2012-10-31 23:37 ` [PATCH] of/irq: stub out public API Rob Herring
2012-11-01 16:50   ` Jeffrey Hugo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1351717765-29395-1-git-send-email-jhugo@codeaurora.org \
    --to=jhugo@codeaurora.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=grant.likely@secretlab.ca \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=rob.herring@calxeda.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).