linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] reset: meson: make it possible to build as a module
@ 2020-10-13 13:39 Neil Armstrong
  2020-10-13 14:57 ` Robin Murphy
  2020-10-16 20:44 ` Kevin Hilman
  0 siblings, 2 replies; 4+ messages in thread
From: Neil Armstrong @ 2020-10-13 13:39 UTC (permalink / raw)
  To: p.zabel; +Cc: linux-amlogic, linux-arm-kernel, linux-kernel, 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")

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
 drivers/reset/Kconfig       | 4 ++--
 drivers/reset/reset-meson.c | 7 ++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
index d9efbfd29646..ab315617565f 100644
--- a/drivers/reset/Kconfig
+++ b/drivers/reset/Kconfig
@@ -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.
 
diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c
index 94d7ba88d7d2..434d5c0f877e 100644
--- a/drivers/reset/reset-meson.c
+++ b/drivers/reset/reset-meson.c
@@ -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 <narmstrong@baylibre.com>");
+MODULE_LICENSE("Dual BSD/GPL");
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] reset: meson: make it possible to build as a module
  2020-10-13 13:39 [PATCH] reset: meson: make it possible to build as a module Neil Armstrong
@ 2020-10-13 14:57 ` Robin Murphy
  2020-10-14  7:43   ` Neil Armstrong
  2020-10-16 20:44 ` Kevin Hilman
  1 sibling, 1 reply; 4+ messages in thread
From: Robin Murphy @ 2020-10-13 14:57 UTC (permalink / raw)
  To: Neil Armstrong, p.zabel; +Cc: linux-amlogic, linux-kernel, linux-arm-kernel

On 2020-10-13 14:39, Neil Armstrong wrote:
> 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")
> 
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>   drivers/reset/Kconfig       | 4 ++--
>   drivers/reset/reset-meson.c | 7 ++++++-
>   2 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
> index d9efbfd29646..ab315617565f 100644
> --- a/drivers/reset/Kconfig
> +++ b/drivers/reset/Kconfig
> @@ -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.

>   	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
> --- a/drivers/reset/reset-meson.c
> +++ b/drivers/reset/reset-meson.c
> @@ -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 <narmstrong@baylibre.com>");
> +MODULE_LICENSE("Dual BSD/GPL");
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] reset: meson: make it possible to build as a module
  2020-10-13 14:57 ` Robin Murphy
@ 2020-10-14  7:43   ` Neil Armstrong
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Armstrong @ 2020-10-14  7:43 UTC (permalink / raw)
  To: Robin Murphy, p.zabel; +Cc: linux-amlogic, linux-kernel, linux-arm-kernel

On 13/10/2020 16:57, Robin Murphy wrote:
> On 2020-10-13 14:39, Neil Armstrong wrote:
>> 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")
>>
>> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
>> ---
>>   drivers/reset/Kconfig       | 4 ++--
>>   drivers/reset/reset-meson.c | 7 ++++++-
>>   2 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
>> index d9efbfd29646..ab315617565f 100644
>> --- a/drivers/reset/Kconfig
>> +++ b/drivers/reset/Kconfig
>> @@ -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... ;)

You're right, thanks for pointing me this.

Neil

> 
> Robin.
> 
>>       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
>> --- a/drivers/reset/reset-meson.c
>> +++ b/drivers/reset/reset-meson.c
>> @@ -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 <narmstrong@baylibre.com>");
>> +MODULE_LICENSE("Dual BSD/GPL");
>>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] reset: meson: make it possible to build as a module
  2020-10-13 13:39 [PATCH] reset: meson: make it possible to build as a module Neil Armstrong
  2020-10-13 14:57 ` Robin Murphy
@ 2020-10-16 20:44 ` Kevin Hilman
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin Hilman @ 2020-10-16 20:44 UTC (permalink / raw)
  To: Neil Armstrong, p.zabel
  Cc: linux-amlogic, linux-arm-kernel, linux-kernel, Neil Armstrong

Neil Armstrong <narmstrong@baylibre.com> writes:

> 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")
>
> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
> ---
>  drivers/reset/Kconfig       | 4 ++--
>  drivers/reset/reset-meson.c | 7 ++++++-
>  2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/reset/Kconfig b/drivers/reset/Kconfig
> index d9efbfd29646..ab315617565f 100644
> --- a/drivers/reset/Kconfig
> +++ b/drivers/reset/Kconfig
> @@ -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.
>  
> diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c
> index 94d7ba88d7d2..434d5c0f877e 100644
> --- a/drivers/reset/reset-meson.c
> +++ b/drivers/reset/reset-meson.c
> @@ -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);

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:

Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: Kevin Hilman <khilman@baylibre.com>

Kevin

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-16 20:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 13:39 [PATCH] reset: meson: make it possible to build as a module Neil Armstrong
2020-10-13 14:57 ` Robin Murphy
2020-10-14  7:43   ` Neil Armstrong
2020-10-16 20:44 ` Kevin Hilman

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).