mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>,
	yurovsky@gmail.com, Shawn Guo <shawnguo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <marc.zyngier@arm.com>
Subject: [PATCH 2/4] irqchip: Add IRQCHIP_DECLARE_DRIVER macro
Date: Thu, 26 Jan 2017 14:05:02 -0800	[thread overview]
Message-ID: <20170126220504.4796-2-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <20170126220504.4796-1-andrew.smirnov@gmail.com>


Add IRQCHIP_DECLARE_DRIVER macro to allow having driver code that both
registers irqchip and a platform driver. Based on analogous code of
CLK_OF_DECLARE_DRIVER.

Cc: yurovsky@gmail.com
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 include/linux/irqchip.h | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/include/linux/irqchip.h b/include/linux/irqchip.h
index 89c34b2..611e8cc 100644
--- a/include/linux/irqchip.h
+++ b/include/linux/irqchip.h
@@ -27,6 +27,22 @@
 #define IRQCHIP_DECLARE(name, compat, fn) OF_DECLARE_2(irqchip, name, compat, fn)
 
 /*
+ * Use this macro when you have a driver that requires two
+ * initialization routines, one at IRQCHIP_DECLARE, and one at
+ * platform device probe
+ */
+#define IRQCHIP_DECLARE_DRIVER(name, compat, fn)			\
+	static int __init						\
+	name##_of_irqchip_init_driver(struct device_node *np,		\
+				      struct device_node *parent)	\
+	{								\
+		of_node_clear_flag(np, OF_POPULATED);			\
+		return fn(np, parent);					\
+	}								\
+	OF_DECLARE_2(irqchip, name, compat, name##_of_irqchip_init_driver)
+
+
+/*
  * This macro must be used by the different irqchip drivers to declare
  * the association between their version and their initialization function.
  *
-- 
2.9.3

  reply	other threads:[~2017-01-26 22:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-26 22:05 [PATCH 1/4] drivers/irqchip: Enable IMX_GPCV2 on i.MX7 by default Andrey Smirnov
2017-01-26 22:05 ` Andrey Smirnov [this message]
2017-01-26 22:05 ` [PATCH 3/4] i.MX: GPC: Use IRQCHIP_DECLARE_DRIVER Andrey Smirnov
2017-01-27  9:54   ` Lucas Stach
2017-01-27 18:16     ` Andrey Smirnov
2017-01-26 22:05 ` [PATCH 4/4] irqchip/imx-gpcv2: Add power domain support Andrey Smirnov
2017-02-01 13:29   ` Rob Herring
  -- strict thread matches above, loose matches on Subject: below --
2017-01-26 21:56 [PATCH 0/4] GPCv2 " Andrey Smirnov
     [not found] ` <20170126215609.4272-3-andrew.smirnov@gmail.com>
     [not found]   ` <a7469257-8444-09a8-ac0c-d1c39c1b4c26@arm.com>
2017-01-27 18:13     ` [PATCH 2/4] irqchip: Add IRQCHIP_DECLARE_DRIVER macro Andrey Smirnov
2017-01-30 11:25       ` Marc Zyngier

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=20170126220504.4796-2-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=shawnguo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=yurovsky@gmail.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

all inboxes | Powered by JetHome®