linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sameer Pujar <spujar@nvidia.com>
To: <tglx@linutronix.de>, <jason@lakedaemon.net>,
	<marc.zyngier@arm.com>, <will.deacon@arm.com>,
	<catalin.marinas@arm.com>, <heiko@sntech.de>,
	<horms+renesas@verge.net.au>, <maxime.ripard@bootlin.com>,
	<andy.gross@linaro.org>, <olof@lixom.net>,
	<bjorn.andersson@linaro.org>, <jagan@amarulasolutions.com>,
	<enric.balletbo@collabora.com>, <stefan.wahren@i2se.com>,
	<ezequiel@collabora.com>, <marc.w.gonzalez@free.fr>,
	<christoffer.dall@arm.com>, <drjones@redhat.com>,
	<julien.thierry@arm.com>
Cc: <treding@nvidia.com>, <jonathanh@nvidia.com>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, Sameer Pujar <spujar@nvidia.com>
Subject: [PATCH 2/5] irqchip/gic: allow gic-pm driver to be used as module
Date: Wed, 13 Mar 2019 16:32:33 +0530	[thread overview]
Message-ID: <1552474956-25513-2-git-send-email-spujar@nvidia.com> (raw)
In-Reply-To: <1552474956-25513-1-git-send-email-spujar@nvidia.com>

In order to use irq-gic-pm driver as module following changes are made.

1. config ARM_GIC_PM is changed to tristate to allow it to be built as
   module.

2. following functions are exported from irq-gic driver.
   * gic_of_init_child()
   * gic_cpu_save()
   * gic_dist_save()
   * gic_cpu_restore()
   * gic_dist_restore()

3. MODULE_LICENSE is added to make sure driver load is successful, else
   it fails to resolve required symbols. The 'builtin_platform_driver' is
   replaced with 'module_platform_driver' to allow driver removal, else it
   complains that device or resource is busy.

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
 drivers/irqchip/Kconfig      | 2 +-
 drivers/irqchip/irq-gic-pm.c | 3 ++-
 drivers/irqchip/irq-gic.c    | 6 ++++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 5438abb..8b5ce12 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -12,7 +12,7 @@ config ARM_GIC
 	select GENERIC_IRQ_EFFECTIVE_AFF_MASK
 
 config ARM_GIC_PM
-	bool
+	tristate "ARM GIC with PM support"
 	depends on PM
 	select ARM_GIC
 	select PM_CLK
diff --git a/drivers/irqchip/irq-gic-pm.c b/drivers/irqchip/irq-gic-pm.c
index 56a785f..cde9714 100644
--- a/drivers/irqchip/irq-gic-pm.c
+++ b/drivers/irqchip/irq-gic-pm.c
@@ -195,4 +195,5 @@ static struct platform_driver gic_driver = {
 	}
 };
 
-builtin_platform_driver(gic_driver);
+module_platform_driver(gic_driver);
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index f88018b..b3ad7ed 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -600,6 +600,7 @@ void gic_dist_save(struct gic_chip_data *gic)
 		gic->saved_spi_active[i] =
 			readl_relaxed(dist_base + GIC_DIST_ACTIVE_SET + i * 4);
 }
+EXPORT_SYMBOL_GPL(gic_dist_save);
 
 /*
  * Restores the GIC distributor registers during resume or when coming out of
@@ -653,6 +654,7 @@ void gic_dist_restore(struct gic_chip_data *gic)
 
 	writel_relaxed(GICD_ENABLE, dist_base + GIC_DIST_CTRL);
 }
+EXPORT_SYMBOL_GPL(gic_dist_restore);
 
 void gic_cpu_save(struct gic_chip_data *gic)
 {
@@ -683,6 +685,7 @@ void gic_cpu_save(struct gic_chip_data *gic)
 		ptr[i] = readl_relaxed(dist_base + GIC_DIST_CONFIG + i * 4);
 
 }
+EXPORT_SYMBOL_GPL(gic_cpu_save);
 
 void gic_cpu_restore(struct gic_chip_data *gic)
 {
@@ -725,6 +728,7 @@ void gic_cpu_restore(struct gic_chip_data *gic)
 	writel_relaxed(GICC_INT_PRI_THRESHOLD, cpu_base + GIC_CPU_PRIMASK);
 	gic_cpu_if_up(gic);
 }
+EXPORT_SYMBOL_GPL(gic_cpu_restore);
 
 static int gic_notifier(struct notifier_block *self, unsigned long cmd,	void *v)
 {
@@ -1410,6 +1414,7 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(gic_of_init_child);
 
 static void __init gic_of_setup_kvm_info(struct device_node *node)
 {
@@ -1496,6 +1501,7 @@ int gic_of_init_child(struct device *dev, struct gic_chip_data **gic, int irq)
 {
 	return -ENOTSUPP;
 }
+EXPORT_SYMBOL_GPL(gic_of_init_child);
 #endif
 
 #ifdef CONFIG_ACPI
-- 
2.7.4


  reply	other threads:[~2019-03-13 11:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-13 11:02 [PATCH 1/5] irqchip/gic-pm: add driver remove support Sameer Pujar
2019-03-13 11:02 ` Sameer Pujar [this message]
2019-03-13 11:02 ` [PATCH 3/5] arm64: defconfig: build gic-pm driver as module Sameer Pujar
2019-03-13 11:02 ` [PATCH 4/5] irqchip/gic-pm: use devm_clk_*() helpers Sameer Pujar
2019-03-13 11:02 ` [PATCH 5/5] irqchip/gic-pm: fix suspend handling Sameer Pujar
2019-03-13 11:22 ` [PATCH 1/5] irqchip/gic-pm: add driver remove support Marc Zyngier
2019-03-13 13:50   ` Sameer Pujar
2019-03-13 14:20     ` Marc Zyngier
2019-03-13 16:34       ` Thierry Reding
2019-03-13 17:57         ` 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=1552474956-25513-2-git-send-email-spujar@nvidia.com \
    --to=spujar@nvidia.com \
    --cc=andy.gross@linaro.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=christoffer.dall@arm.com \
    --cc=drjones@redhat.com \
    --cc=enric.balletbo@collabora.com \
    --cc=ezequiel@collabora.com \
    --cc=heiko@sntech.de \
    --cc=horms+renesas@verge.net.au \
    --cc=jagan@amarulasolutions.com \
    --cc=jason@lakedaemon.net \
    --cc=jonathanh@nvidia.com \
    --cc=julien.thierry@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.w.gonzalez@free.fr \
    --cc=marc.zyngier@arm.com \
    --cc=maxime.ripard@bootlin.com \
    --cc=olof@lixom.net \
    --cc=stefan.wahren@i2se.com \
    --cc=tglx@linutronix.de \
    --cc=treding@nvidia.com \
    --cc=will.deacon@arm.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).