Skip to contentSkip to conversation

reset: meson: make it possible to build as a module

PATCH Superseded Neil Armstrong 3 participants 4 messages Oct 13, 2020 – Oct 16, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reset: meson: 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 reset controller driver as a module.

This partially reverts 8290924e ("reset: meson: make it explicitly non-modular")

---
 drivers/reset/Kconfig       | 4 ++--
 drivers/reset/reset-meson.c | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/reset/Kconfig +2 -2
index d9efbfd29646..ab315617565f 100644
@@ -94,8 +94,8 @@ config RESET_LPC18XX
 	  This enables the reset controller driver for NXP LPC18xx/43xx SoCs.
 
 config RESET_MESON
-	bool "Meson Reset Driver" if COMPILE_TEST
-	default ARCH_MESON
+	tristate "Meson Reset Driver"
+	default ARCH_MESON || COMPILE_TEST
 	help
 	  This enables the reset driver for Amlogic Meson SoCs.
 
drivers/reset/reset-meson.c +6 -1
index 94d7ba88d7d2..434d5c0f877e 100644
@@ -9,6 +9,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/of.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
 #include <linux/slab.h>
@@ -142,4 +143,8 @@ static struct platform_driver meson_reset_driver = {
 		.of_match_table	= meson_reset_dt_ids,
 	},
 };
-builtin_platform_driver(meson_reset_driver);
+module_platform_driver(meson_reset_driver);
+
+MODULE_DESCRIPTION("Amlogic Meson Reset Controller driver");
+MODULE_AUTHOR("Neil Armstrong <[email protected]>");
+MODULE_LICENSE("Dual BSD/GPL");
Signature · 1 line
2.25.1
#1 lore raw
Quoted 16 lines · Neil Armstrong

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

This partially reverts 8290924e ("reset: meson: make it explicitly non-modular")

---
  drivers/reset/Kconfig       | 4 ++--
  drivers/reset/reset-meson.c | 7 ++++++-
  2 files changed, 8 insertions(+), 3 deletions(-)
drivers/reset/Kconfig +0 -0
index d9efbfd29646..ab315617565f 100644

drivers/reset/Kconfig config RESET_LPC18XX · line 98

Quoted 7 lines
drivers/reset/Kconfig +2 -2
@@ -94,8 +94,8 @@ config RESET_LPC18XX
  	  This enables the reset controller driver for NXP LPC18xx/43xx SoCs.
 
  config RESET_MESON
-	bool "Meson Reset Driver" if COMPILE_TEST
-	default ARCH_MESON
+	tristate "Meson Reset Driver"
+	default ARCH_MESON || COMPILE_TEST

How about an actual dependency like:

	depends on ARCH_MESON || COMPILE_TEST
	default ARCH_MESON

?

That way the option won't be presented to users where it's completely irrelevant, e.g. running "make oldconfig" with an x86 distro config. It always bugs me when I rebase a branch and have to manually confirm that indeed I don't want to build random drivers specific to x86/RISC-V/etc. SoCs for my arm64 config... ;)

Robin.

Quoted 26 lines
drivers/reset/Kconfig +0 -0
  	help
  	  This enables the reset driver for Amlogic Meson SoCs.
 
drivers/reset/reset-meson.c +6 -1
index 94d7ba88d7d2..434d5c0f877e 100644
@@ -9,6 +9,7 @@
  #include <linux/init.h>
  #include <linux/io.h>
  #include <linux/of.h>
+#include <linux/module.h>
  #include <linux/platform_device.h>
  #include <linux/reset-controller.h>
  #include <linux/slab.h>
@@ -142,4 +143,8 @@ static struct platform_driver meson_reset_driver = {
  		.of_match_table	= meson_reset_dt_ids,
  	},
  };
-builtin_platform_driver(meson_reset_driver);
+module_platform_driver(meson_reset_driver);
+
+MODULE_DESCRIPTION("Amlogic Meson Reset Controller driver");
+MODULE_AUTHOR("Neil Armstrong <[email protected]>");
+MODULE_LICENSE("Dual BSD/GPL");
#2 lore raw
Quoted 26 lines · Robin Murphy
Quoted 16 lines · Neil Armstrong

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

This partially reverts 8290924e ("reset: meson: make it explicitly non-modular")

---
  drivers/reset/Kconfig       | 4 ++--
  drivers/reset/reset-meson.c | 7 ++++++-

  2 files changed, 8 insertions(+), 3 deletions(-)
drivers/reset/Kconfig +0 -0
index d9efbfd29646..ab315617565f 100644
@@ -94,8 +94,8 @@ config RESET_LPC18XX
Quoted 6 lines

        This enables the reset controller driver for NXP LPC18xx/43xx SoCs. config RESET_MESON
-    bool "Meson Reset Driver" if COMPILE_TEST
-    default ARCH_MESON
+    tristate "Meson Reset Driver"
+    default ARCH_MESON || COMPILE_TEST

How about an actual dependency like:

Quoted 5 lines

    depends on ARCH_MESON || COMPILE_TEST
    default ARCH_MESON
?

That way the option won't be presented to users where it's completely irrelevant, e.g. running "make oldconfig" with an x86 distro config. It always bugs me when I rebase a branch and have to manually confirm that indeed I don't want to build random drivers specific to x86/RISC-V/etc. SoCs for my arm64 config... ;)

You're right, thanks for pointing me this.

Neil

Quoted 20 lines

Robin.

Quoted 17 lines

      help
        This enables the reset driver for Amlogic Meson SoCs. diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 94d7ba88d7d2..434d5c0f877e 100644

drivers/reset/reset-meson.c +1 -0
@@ -9,6 +9,7 @@
   #include <linux/init.h>
   #include <linux/io.h>
   #include <linux/of.h>
+#include <linux/module.h>
   #include <linux/platform_device.h>
   #include <linux/reset-controller.h>
   #include <linux/slab.h>
@@ -142,4 +143,8 @@ static struct platform_driver meson_reset_driver = {
           .of_match_table    = meson_reset_dt_ids,
       },
Quoted 8 lines

drivers/reset/reset-meson.c static struct platform_driver meson_reset_driver = { · line 150

Quoted 8 lines
drivers/reset/reset-meson.c +5 -1
   };
-builtin_platform_driver(meson_reset_driver);
+module_platform_driver(meson_reset_driver);
+
+MODULE_DESCRIPTION("Amlogic Meson Reset Controller driver");
+MODULE_AUTHOR("Neil Armstrong <[email protected]>");
+MODULE_LICENSE("Dual BSD/GPL");

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

maintainer Reviewed-by Tested-by on v1 1/1
#3 lore raw
In reply to Neil Armstrong
Quoted 39 lines · Neil Armstrong

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

This partially reverts 8290924e ("reset: meson: make it explicitly non-modular")

---
 drivers/reset/Kconfig       | 4 ++--
 drivers/reset/reset-meson.c | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/reset/Kconfig +2 -2
index d9efbfd29646..ab315617565f 100644
@@ -94,8 +94,8 @@ config RESET_LPC18XX
 	  This enables the reset controller driver for NXP LPC18xx/43xx SoCs.
 
 config RESET_MESON
-	bool "Meson Reset Driver" if COMPILE_TEST
-	default ARCH_MESON
+	tristate "Meson Reset Driver"
+	default ARCH_MESON || COMPILE_TEST
 	help
 	  This enables the reset driver for Amlogic Meson SoCs.
 
drivers/reset/reset-meson.c +1 -0
index 94d7ba88d7d2..434d5c0f877e 100644
@@ -9,6 +9,7 @@
 #include <linux/init.h>
 #include <linux/io.h>
 #include <linux/of.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/reset-controller.h>
 #include <linux/slab.h>

drivers/reset/reset-meson.c static struct platform_driver meson_reset_driver = { · line 146

Quoted 5 lines
drivers/reset/reset-meson.c +1 -1
@@ -142,4 +143,8 @@ static struct platform_driver meson_reset_driver = {
 		.of_match_table	= meson_reset_dt_ids,
 	},
 };
-builtin_platform_driver(meson_reset_driver);
+module_platform_driver(meson_reset_driver);

I tried this as as a module, and it never probed because it's missing this on the compatible table:

   MODULE_DEVICE_TABLE(of, meson_reset_dt_ids);

With that minor change:

Kevin