Skip to contentSkip to conversation

irq-meson-gpio: make it possible to build as a module

PATCH Applied Neil Armstrong 6 participants 11 messages Sep 2, 2021 – Oct 20, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover irq-meson-gpio: make it possible to build as a module

In order to reduce the kernel Image size on multi-platform distributions, make it possible to build the Amlogic GPIO IRQ controller as a module by switching it to a platform driver.

The second patch removes MESON_IRQ_GPIO selection from ARCH_MESON to allow building the driver as module.

Changes since v1:
- makes usage of IRQCHIP_PLATFORM_DRIVER_BEGIN/MATCH/PLATFORM_DRIVER_END

Neil Armstrong (2):
irqchip: irq-meson-gpio: make it possible to build as a module
arm64: meson: remove MESON_IRQ_GPIO selection

 arch/arm64/Kconfig.platforms     |  1 -
 drivers/irqchip/Kconfig          |  5 +++--
 drivers/irqchip/irq-meson-gpio.c | 15 +++++++++------
 3 files changed, 12 insertions(+), 9 deletions(-)
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/2 irqchip: irq-meson-gpio: make it possible to build as a module

In order to reduce the kernel Image size on multi-platform distributions, make it possible to build the Amlogic GPIO IRQ controller as a module by switching it to a platform driver.

---
 drivers/irqchip/Kconfig          |  5 +++--
 drivers/irqchip/irq-meson-gpio.c | 15 +++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)
drivers/irqchip/Kconfig +3 -2
index 4d5924e9f766..2aba485025fd 100644
@@ -400,8 +400,9 @@ config IRQ_UNIPHIER_AIDET
 	  Support for the UniPhier AIDET (ARM Interrupt Detector).
 
 config MESON_IRQ_GPIO
-       bool "Meson GPIO Interrupt Multiplexer"
-       depends on ARCH_MESON
+       tristate "Meson GPIO Interrupt Multiplexer"
+       depends on ARCH_MESON || COMPILE_TEST
+       default ARCH_MESON
        select IRQ_DOMAIN_HIERARCHY
        help
          Support Meson SoC Family GPIO Interrupt Multiplexer
drivers/irqchip/irq-meson-gpio.c +9 -6
index e50676ce2ec8..d90ff0b92480 100644
@@ -436,8 +436,7 @@ static const struct irq_domain_ops meson_gpio_irq_domain_ops = {
 	.translate	= meson_gpio_irq_domain_translate,
 };
 
-static int __init meson_gpio_irq_parse_dt(struct device_node *node,
-					  struct meson_gpio_irq_controller *ctl)
+static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_irq_controller *ctl)
 {
 	const struct of_device_id *match;
 	int ret;
@@ -463,8 +462,7 @@ static int __init meson_gpio_irq_parse_dt(struct device_node *node,
 	return 0;
 }
 
-static int __init meson_gpio_irq_of_init(struct device_node *node,
-					 struct device_node *parent)
+static int meson_gpio_irq_of_init(struct device_node *node, struct device_node *parent)
 {
 	struct irq_domain *domain, *parent_domain;
 	struct meson_gpio_irq_controller *ctl;
@@ -521,5 +519,10 @@ static int __init meson_gpio_irq_of_init(struct device_node *node,
 	return ret;
 }
 
-IRQCHIP_DECLARE(meson_gpio_intc, "amlogic,meson-gpio-intc",
-		meson_gpio_irq_of_init);
+IRQCHIP_PLATFORM_DRIVER_BEGIN(meson_gpio_intc)
+IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init)
+IRQCHIP_PLATFORM_DRIVER_END(meson_gpio_intc)
+
+MODULE_AUTHOR("Jerome Brunet <[email protected]>");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:meson-gpio-intc");
Signature · 1 line
2.25.1
Acked-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] irqchip: irq-meson-gpio: make it possible to build as a module

Quoted 55 lines · Neil Armstrong

In order to reduce the kernel Image size on multi-platform distributions, make it possible to build the Amlogic GPIO IRQ controller as a module by switching it to a platform driver.

---
 drivers/irqchip/Kconfig          |  5 +++--
 drivers/irqchip/irq-meson-gpio.c | 15 +++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)
drivers/irqchip/Kconfig +3 -2
index 4d5924e9f766..2aba485025fd 100644
@@ -400,8 +400,9 @@ config IRQ_UNIPHIER_AIDET
          Support for the UniPhier AIDET (ARM Interrupt Detector).
 
 config MESON_IRQ_GPIO
-       bool "Meson GPIO Interrupt Multiplexer"
-       depends on ARCH_MESON
+       tristate "Meson GPIO Interrupt Multiplexer"
+       depends on ARCH_MESON || COMPILE_TEST
+       default ARCH_MESON
        select IRQ_DOMAIN_HIERARCHY
        help
          Support Meson SoC Family GPIO Interrupt Multiplexer
drivers/irqchip/irq-meson-gpio.c +2 -4
index e50676ce2ec8..d90ff0b92480 100644
@@ -436,8 +436,7 @@ static const struct irq_domain_ops meson_gpio_irq_domain_ops = {
        .translate      = meson_gpio_irq_domain_translate,
 };
 
-static int __init meson_gpio_irq_parse_dt(struct device_node *node,
-                                         struct meson_gpio_irq_controller *ctl)
+static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_irq_controller *ctl)
 {
        const struct of_device_id *match;
        int ret;
@@ -463,8 +462,7 @@ static int __init meson_gpio_irq_parse_dt(struct device_node *node,
        return 0;
 }
 
-static int __init meson_gpio_irq_of_init(struct device_node *node,
-                                        struct device_node *parent)
+static int meson_gpio_irq_of_init(struct device_node *node, struct device_node *parent)
 {
        struct irq_domain *domain, *parent_domain;
        struct meson_gpio_irq_controller *ctl;
@@ -521,5 +519,10 @@ static int __init meson_gpio_irq_of_init(struct device_node *node,
        return ret;
 }
 

drivers/irqchip/irq-meson-gpio.c static int __init meson_gpio_irq_of_init(struct device_node *node,

Quoted 10 lines
drivers/irqchip/irq-meson-gpio.c +7 -3
-IRQCHIP_DECLARE(meson_gpio_intc, "amlogic,meson-gpio-intc",
-               meson_gpio_irq_of_init);
+IRQCHIP_PLATFORM_DRIVER_BEGIN(meson_gpio_intc)
+IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init)
+IRQCHIP_PLATFORM_DRIVER_END(meson_gpio_intc)
+
+MODULE_AUTHOR("Jerome Brunet <[email protected]>");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:meson-gpio-intc");
--

Marc, my mdio-mux patches have landed.

-Saravana

Reviewed-by
#3 lore raw

Re: [PATCH 1/2] irqchip: irq-meson-gpio: make it possible to build as a module

Quoted 69 lines · Saravana Kannan
Quoted 55 lines · Neil Armstrong

In order to reduce the kernel Image size on multi-platform distributions, make it possible to build the Amlogic GPIO IRQ controller as a module by switching it to a platform driver.

---
 drivers/irqchip/Kconfig          |  5 +++--
 drivers/irqchip/irq-meson-gpio.c | 15 +++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)
drivers/irqchip/Kconfig +3 -2
index 4d5924e9f766..2aba485025fd 100644
@@ -400,8 +400,9 @@ config IRQ_UNIPHIER_AIDET
          Support for the UniPhier AIDET (ARM Interrupt Detector).
 
 config MESON_IRQ_GPIO
-       bool "Meson GPIO Interrupt Multiplexer"
-       depends on ARCH_MESON
+       tristate "Meson GPIO Interrupt Multiplexer"
+       depends on ARCH_MESON || COMPILE_TEST
+       default ARCH_MESON
        select IRQ_DOMAIN_HIERARCHY
        help
          Support Meson SoC Family GPIO Interrupt Multiplexer
drivers/irqchip/irq-meson-gpio.c +2 -4
index e50676ce2ec8..d90ff0b92480 100644
@@ -436,8 +436,7 @@ static const struct irq_domain_ops meson_gpio_irq_domain_ops = {
        .translate      = meson_gpio_irq_domain_translate,
 };
 
-static int __init meson_gpio_irq_parse_dt(struct device_node *node,
-                                         struct meson_gpio_irq_controller *ctl)
+static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_irq_controller *ctl)
 {
        const struct of_device_id *match;
        int ret;
@@ -463,8 +462,7 @@ static int __init meson_gpio_irq_parse_dt(struct device_node *node,
        return 0;
 }
 
-static int __init meson_gpio_irq_of_init(struct device_node *node,
-                                        struct device_node *parent)
+static int meson_gpio_irq_of_init(struct device_node *node, struct device_node *parent)
 {
        struct irq_domain *domain, *parent_domain;
        struct meson_gpio_irq_controller *ctl;
@@ -521,5 +519,10 @@ static int __init meson_gpio_irq_of_init(struct device_node *node,
        return ret;
 }
 

drivers/irqchip/irq-meson-gpio.c static int __init meson_gpio_irq_of_init(struct device_node *node,

Quoted 10 lines
drivers/irqchip/irq-meson-gpio.c +7 -3
-IRQCHIP_DECLARE(meson_gpio_intc, "amlogic,meson-gpio-intc",
-               meson_gpio_irq_of_init);
+IRQCHIP_PLATFORM_DRIVER_BEGIN(meson_gpio_intc)
+IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init)
+IRQCHIP_PLATFORM_DRIVER_END(meson_gpio_intc)
+
+MODULE_AUTHOR("Jerome Brunet <[email protected]>");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:meson-gpio-intc");
--
Quoted 1 line

Marc, my mdio-mux patches have landed.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw

Re: [PATCH 1/2] irqchip: irq-meson-gpio: make it possible to build as a module

In reply to Neil Armstrong
I love your patch! Yet something to improve:

Hi Neil,

I love your patch! Yet something to improve:

[auto build test ERROR on tip/irq/core]
[also build test ERROR on arm64/for-next/core arm/for-next soc/for-next clk/clk-next kvmarm/next v5.14 next-20210902] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Neil-Armstrong/irq-meson-gpio-make-it-possible-to-build-as-a-module/20210902-215046
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 47fb0cfdb7a71a8a0ff8fe1d117363dc81f6ca77
config: parisc-randconfig-r023-20210903 (attached as .config)
compiler: hppa-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/90a6017feb62f008db14c9e8a2722d96dfca3a12
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Neil-Armstrong/irq-meson-gpio-make-it-possible-to-build-as-a-module/20210902-215046 git checkout 90a6017feb62f008db14c9e8a2722d96dfca3a12
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=parisc

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>, old ones prefixed by <<):

>> ERROR: modpost: "platform_irqchip_probe" [drivers/irqchip/irq-meson-gpio.ko] undefined!

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#5 lore raw

Re: [PATCH 1/2] irqchip: irq-meson-gpio: make it possible to build as a module

In reply to Neil Armstrong
I love your patch! Perhaps something to improve:

Hi Neil,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tip/irq/core]
[also build test WARNING on arm64/for-next/core xlnx/master arm/for-next soc/for-next clk/clk-next kvmarm/next v5.14 next-20210902] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Neil-Armstrong/irq-meson-gpio-make-it-possible-to-build-as-a-module/20210902-215046
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 47fb0cfdb7a71a8a0ff8fe1d117363dc81f6ca77
config: mips-randconfig-r016-20210903 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c9948e9254fbb6ea00f66c7b4542311d21e060be)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://github.com/0day-ci/linux/commit/90a6017feb62f008db14c9e8a2722d96dfca3a12
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Neil-Armstrong/irq-meson-gpio-make-it-possible-to-build-as-a-module/20210902-215046 git checkout 90a6017feb62f008db14c9e8a2722d96dfca3a12
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=mips

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/irqchip/irq-meson-gpio.c:124:34: warning: unused variable 'meson_irq_gpio_matches' [-Wunused-const-variable]
   static const struct of_device_id meson_irq_gpio_matches[] = {
                                    ^

1 warning generated.

vim +/meson_irq_gpio_matches +124 drivers/irqchip/irq-meson-gpio.c

8f78bd62bdd7a7 Qianggui Song 2019-12-16 123

215f4cc0fb2086 Jerome Brunet       2017-09-18 @124  static const struct of_device_id meson_irq_gpio_matches[] = {
4e4cb1b183d6e9 Martin Blumenstingl 2017-10-30  125  	{ .compatible = "amlogic,meson8-gpio-intc", .data = &meson8_params },
215f4cc0fb2086 Jerome Brunet       2017-09-18  126  	{ .compatible = "amlogic,meson8b-gpio-intc", .data = &meson8b_params },
215f4cc0fb2086 Jerome Brunet       2017-09-18  127  	{ .compatible = "amlogic,meson-gxbb-gpio-intc", .data = &gxbb_params },
215f4cc0fb2086 Jerome Brunet       2017-09-18  128  	{ .compatible = "amlogic,meson-gxl-gpio-intc", .data = &gxl_params },
868c4e07533c67 Yixun Lan           2018-04-08  129  	{ .compatible = "amlogic,meson-axg-gpio-intc", .data = &axg_params },
c64a9e804ccf86 Xingyu Chen         2019-06-08  130  	{ .compatible = "amlogic,meson-g12a-gpio-intc", .data = &axg_params },
b2fb4b77994abc Jerome Brunet       2019-08-29  131  	{ .compatible = "amlogic,meson-sm1-gpio-intc", .data = &sm1_params },
8f78bd62bdd7a7 Qianggui Song       2019-12-16  132  	{ .compatible = "amlogic,meson-a1-gpio-intc", .data = &a1_params },
215f4cc0fb2086 Jerome Brunet       2017-09-18  133  	{ }
215f4cc0fb2086 Jerome Brunet       2017-09-18  134  };

215f4cc0fb2086 Jerome Brunet 2017-09-18 135

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

maintainer Reviewed-by Tested-by on v1 1/2
#6 lore raw

Re: [PATCH 1/2] irqchip: irq-meson-gpio: make it possible to build as a module

In reply to Neil Armstrong
Quoted 5 lines · Neil Armstrong

In order to reduce the kernel Image size on multi-platform distributions, make it possible to build the Amlogic GPIO IRQ controller as a module by switching it to a platform driver.

#7 lore raw

[irqchip: irq/irqchip-next] irqchip/meson-gpio: Make it possible to build as a module

In reply to Neil Armstrong
The following commit has been merged into the irq/irqchip-next branch of irqchip:

The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID:     a947aa00edd4d465f89fdb6029ed40c00a344bc2
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/a947aa00edd4d465f89fdb6029ed40c00a344bc2
Author:        Neil Armstrong <[email protected]>
AuthorDate:    Thu, 02 Sep 2021 15:49:13 +02:00
Committer:     Marc Zyngier <[email protected]>
CommitterDate: Wed, 20 Oct 2021 19:38:01 +01:00

irqchip/meson-gpio: Make it possible to build as a module

In order to reduce the kernel Image size on multi-platform distributions, make it possible to build the Amlogic GPIO IRQ controller as a module by switching it to a platform driver.

---
 drivers/irqchip/Kconfig          |  5 +++--
 drivers/irqchip/irq-meson-gpio.c | 15 +++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)
drivers/irqchip/Kconfig +3 -2
index aca7b59..6a4496f 100644
@@ -400,8 +400,9 @@ config IRQ_UNIPHIER_AIDET
 	  Support for the UniPhier AIDET (ARM Interrupt Detector).
 
 config MESON_IRQ_GPIO
-       bool "Meson GPIO Interrupt Multiplexer"
-       depends on ARCH_MESON
+       tristate "Meson GPIO Interrupt Multiplexer"
+       depends on ARCH_MESON || COMPILE_TEST
+       default ARCH_MESON
        select IRQ_DOMAIN_HIERARCHY
        help
          Support Meson SoC Family GPIO Interrupt Multiplexer
drivers/irqchip/irq-meson-gpio.c +9 -6
index e50676c..d90ff0b 100644
@@ -436,8 +436,7 @@ static const struct irq_domain_ops meson_gpio_irq_domain_ops = {
 	.translate	= meson_gpio_irq_domain_translate,
 };
 
-static int __init meson_gpio_irq_parse_dt(struct device_node *node,
-					  struct meson_gpio_irq_controller *ctl)
+static int meson_gpio_irq_parse_dt(struct device_node *node, struct meson_gpio_irq_controller *ctl)
 {
 	const struct of_device_id *match;
 	int ret;
@@ -463,8 +462,7 @@ static int __init meson_gpio_irq_parse_dt(struct device_node *node,
 	return 0;
 }
 
-static int __init meson_gpio_irq_of_init(struct device_node *node,
-					 struct device_node *parent)
+static int meson_gpio_irq_of_init(struct device_node *node, struct device_node *parent)
 {
 	struct irq_domain *domain, *parent_domain;
 	struct meson_gpio_irq_controller *ctl;
@@ -521,5 +519,10 @@ free_ctl:
 	return ret;
 }
 
-IRQCHIP_DECLARE(meson_gpio_intc, "amlogic,meson-gpio-intc",
-		meson_gpio_irq_of_init);
+IRQCHIP_PLATFORM_DRIVER_BEGIN(meson_gpio_intc)
+IRQCHIP_MATCH("amlogic,meson-gpio-intc", meson_gpio_irq_of_init)
+IRQCHIP_PLATFORM_DRIVER_END(meson_gpio_intc)
+
+MODULE_AUTHOR("Jerome Brunet <[email protected]>");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:meson-gpio-intc");
#8 lore raw

PATCH 2/2 arm64: meson: remove MESON_IRQ_GPIO selection

In reply to Neil Armstrong

Selecting MESON_IRQ_GPIO forces it as built-in, but we may need to build it as a module, thus remove it here and let the "default ARCH_MESON" build as built-in by default with the option to switch it to module.

---
 arch/arm64/Kconfig.platforms | 1 -
 1 file changed, 1 deletion(-)
arch/arm64/Kconfig.platforms +0 -1
index b0ce18d4cc98..ff2d83fbbde1 100644
@@ -167,7 +167,6 @@ config ARCH_MEDIATEK
 config ARCH_MESON
 	bool "Amlogic Platforms"
 	select COMMON_CLK
-	select MESON_IRQ_GPIO
 	help
 	  This enables support for the arm64 based Amlogic SoCs
 	  such as the s905, S905X/D, S912, A113X/D or S905X/D2
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 2/2
#9 lore raw

Re: [PATCH 2/2] arm64: meson: remove MESON_IRQ_GPIO selection

Quoted 5 lines · Neil Armstrong

Selecting MESON_IRQ_GPIO forces it as built-in, but we may need to build it as a module, thus remove it here and let the "default ARCH_MESON" build as built-in by default with the option to switch it to module.

#10 lore raw

[irqchip: irq/irqchip-next] arm64: meson: remove MESON_IRQ_GPIO selection

In reply to Neil Armstrong
The following commit has been merged into the irq/irqchip-next branch of irqchip:

The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID:     dfd8c90eb28b8f7c77ce7173c4bae591b26ea51a
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/dfd8c90eb28b8f7c77ce7173c4bae591b26ea51a
Author:        Neil Armstrong <[email protected]>
AuthorDate:    Thu, 02 Sep 2021 15:49:14 +02:00
Committer:     Marc Zyngier <[email protected]>
CommitterDate: Wed, 20 Oct 2021 19:38:21 +01:00

arm64: meson: remove MESON_IRQ_GPIO selection

Selecting MESON_IRQ_GPIO forces it as built-in, but we may need to build it as a module, thus remove it here and let the "default ARCH_MESON" build as built-in by default with the option to switch it to module.

---
 arch/arm64/Kconfig.platforms | 1 -
 1 file changed, 1 deletion(-)
arch/arm64/Kconfig.platforms +0 -1
index b0ce18d..ff2d83f 100644
@@ -167,7 +167,6 @@ config ARCH_MEDIATEK
 config ARCH_MESON
 	bool "Amlogic Platforms"
 	select COMMON_CLK
-	select MESON_IRQ_GPIO
 	help
 	  This enables support for the arm64 based Amlogic SoCs
 	  such as the s905, S905X/D, S912, A113X/D or S905X/D2