linux-samsung-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] soc: samsung: be a module!
@ 2021-09-17 17:51 Krzysztof Kozlowski
  2021-09-17 17:51 ` [PATCH 1/2] soc: export soc_device_to_device symbol Krzysztof Kozlowski
  2021-09-17 17:51 ` [PATCH 2/2] soc: samsung: exynos-chipid: convert to a module Krzysztof Kozlowski
  0 siblings, 2 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-09-17 17:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Krzysztof Kozlowski,
	linux-kernel, linux-arm-kernel, linux-samsung-soc
  Cc: Marek Szyprowski, Sylwester Nawrocki, Bartlomiej Zolnierkiewicz,
	Tomasz Figa, Arnd Bergmann, Olof Johansson, Alim Akhtar,
	Chanwoo Choi, Pankaj Dubey

Hi,

A question - what is the convention for naming modules: underscores '_' or
hyphens '-'?

The C-unit file already uses a hyphen "exynos-chipid.c", so I could
create a module named:
1. exynos_chipid
2. soc-exynos-chipid
3. exynos-chip-id

The Linux device name is "exynos-chipid".

Best regards,
Krzysztof


Krzysztof Kozlowski (2):
  soc: export soc_device_to_device symbol
  soc: samsung: exynos-chipid: convert to a module

 drivers/base/soc.c                   |  1 +
 drivers/soc/samsung/Kconfig          |  3 ++-
 drivers/soc/samsung/Makefile         |  3 ++-
 drivers/soc/samsung/exynos-chipid.c  | 11 ++++++++++-
 drivers/soc/samsung/exynos5422-asv.c |  1 +
 5 files changed, 16 insertions(+), 3 deletions(-)

-- 
2.30.2


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

* [PATCH 1/2] soc: export soc_device_to_device symbol
  2021-09-17 17:51 [PATCH 0/2] soc: samsung: be a module! Krzysztof Kozlowski
@ 2021-09-17 17:51 ` Krzysztof Kozlowski
  2021-09-18  7:02   ` Greg Kroah-Hartman
  2021-09-17 17:51 ` [PATCH 2/2] soc: samsung: exynos-chipid: convert to a module Krzysztof Kozlowski
  1 sibling, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-09-17 17:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Krzysztof Kozlowski,
	linux-kernel, linux-arm-kernel, linux-samsung-soc
  Cc: Marek Szyprowski, Sylwester Nawrocki, Bartlomiej Zolnierkiewicz,
	Tomasz Figa, Arnd Bergmann, Olof Johansson, Alim Akhtar,
	Chanwoo Choi, Pankaj Dubey

In case if soc-bus drivers are modules soc_device_to_device() has to be
exported.  Since it is trivial, export it as non-GPL.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/base/soc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index 0af5363a582c..ac8db303daa1 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -41,6 +41,7 @@ struct device *soc_device_to_device(struct soc_device *soc_dev)
 {
 	return &soc_dev->dev;
 }
+EXPORT_SYMBOL(soc_device_to_device);
 
 static umode_t soc_attribute_mode(struct kobject *kobj,
 				struct attribute *attr,
-- 
2.30.2


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

* [PATCH 2/2] soc: samsung: exynos-chipid: convert to a module
  2021-09-17 17:51 [PATCH 0/2] soc: samsung: be a module! Krzysztof Kozlowski
  2021-09-17 17:51 ` [PATCH 1/2] soc: export soc_device_to_device symbol Krzysztof Kozlowski
@ 2021-09-17 17:51 ` Krzysztof Kozlowski
  2021-10-05 12:03   ` Sam Protsenko
  1 sibling, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-09-17 17:51 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Krzysztof Kozlowski,
	linux-kernel, linux-arm-kernel, linux-samsung-soc
  Cc: Marek Szyprowski, Sylwester Nawrocki, Bartlomiej Zolnierkiewicz,
	Tomasz Figa, Arnd Bergmann, Olof Johansson, Alim Akhtar,
	Chanwoo Choi, Pankaj Dubey

Exynos ChipID and ASV (Adaptive Supply Voltage) driver is not essential
to system boot and it can successfully be built and loaded as module.

This makes core kernel image smaller and reduces the memory footprint
when multi-platform kernel is booted on non-Exynos board.  Usually it is
also distro-friendly.

Add multiple authors of the driver since its conversion from
mach-exynos, ordered alphabetically by first name.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 drivers/soc/samsung/Kconfig          |  3 ++-
 drivers/soc/samsung/Makefile         |  3 ++-
 drivers/soc/samsung/exynos-chipid.c  | 11 ++++++++++-
 drivers/soc/samsung/exynos5422-asv.c |  1 +
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig
index 1f643c0f5c93..fe139f26d093 100644
--- a/drivers/soc/samsung/Kconfig
+++ b/drivers/soc/samsung/Kconfig
@@ -13,13 +13,14 @@ config EXYNOS_ASV_ARM
 	depends on EXYNOS_CHIPID
 
 config EXYNOS_CHIPID
-	bool "Exynos ChipID controller and ASV driver" if COMPILE_TEST
+	tristate "Exynos ChipID controller and ASV driver" if COMPILE_TEST
 	depends on ARCH_EXYNOS || COMPILE_TEST
 	select EXYNOS_ASV_ARM if ARM && ARCH_EXYNOS
 	select MFD_SYSCON
 	select SOC_BUS
 	help
 	  Support for Samsung Exynos SoC ChipID and Adaptive Supply Voltage.
+	  This driver can also be built as module (exynos_chipid).
 
 config EXYNOS_PMU
 	bool "Exynos PMU controller driver" if COMPILE_TEST
diff --git a/drivers/soc/samsung/Makefile b/drivers/soc/samsung/Makefile
index 0c523a8de4eb..2ae4bea804cf 100644
--- a/drivers/soc/samsung/Makefile
+++ b/drivers/soc/samsung/Makefile
@@ -1,8 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 
 obj-$(CONFIG_EXYNOS_ASV_ARM)	+= exynos5422-asv.o
+obj-$(CONFIG_EXYNOS_CHIPID)	+= exynos_chipid.o
+exynos_chipid-y			+= exynos-chipid.o exynos-asv.o
 
-obj-$(CONFIG_EXYNOS_CHIPID)	+= exynos-chipid.o exynos-asv.o
 obj-$(CONFIG_EXYNOS_PMU)	+= exynos-pmu.o
 
 obj-$(CONFIG_EXYNOS_PMU_ARM_DRIVERS)	+= exynos3250-pmu.o exynos4-pmu.o \
diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
index 5c1d0f97f766..5e8c957231ff 100644
--- a/drivers/soc/samsung/exynos-chipid.c
+++ b/drivers/soc/samsung/exynos-chipid.c
@@ -15,6 +15,7 @@
 #include <linux/device.h>
 #include <linux/errno.h>
 #include <linux/mfd/syscon.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
@@ -129,6 +130,7 @@ static const struct of_device_id exynos_chipid_of_device_ids[] = {
 	{ .compatible = "samsung,exynos4210-chipid" },
 	{}
 };
+MODULE_DEVICE_TABLE(of, exynos_chipid_of_device_ids);
 
 static struct platform_driver exynos_chipid_driver = {
 	.driver = {
@@ -138,4 +140,11 @@ static struct platform_driver exynos_chipid_driver = {
 	.probe	= exynos_chipid_probe,
 	.remove	= exynos_chipid_remove,
 };
-builtin_platform_driver(exynos_chipid_driver);
+module_platform_driver(exynos_chipid_driver);
+
+MODULE_DESCRIPTION("Samsung Exynos ChipID controller and ASV driver");
+MODULE_AUTHOR("Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>");
+MODULE_AUTHOR("Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>");
+MODULE_AUTHOR("Pankaj Dubey <pankaj.dubey@samsung.com>");
+MODULE_AUTHOR("Sylwester Nawrocki <s.nawrocki@samsung.com>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/soc/samsung/exynos5422-asv.c b/drivers/soc/samsung/exynos5422-asv.c
index ca409a976e34..475ae5276529 100644
--- a/drivers/soc/samsung/exynos5422-asv.c
+++ b/drivers/soc/samsung/exynos5422-asv.c
@@ -503,3 +503,4 @@ int exynos5422_asv_init(struct exynos_asv *asv)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(exynos5422_asv_init);
-- 
2.30.2


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

* Re: [PATCH 1/2] soc: export soc_device_to_device symbol
  2021-09-17 17:51 ` [PATCH 1/2] soc: export soc_device_to_device symbol Krzysztof Kozlowski
@ 2021-09-18  7:02   ` Greg Kroah-Hartman
  2021-09-19  9:12     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 7+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-18  7:02 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Rafael J. Wysocki, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, Marek Szyprowski, Sylwester Nawrocki,
	Bartlomiej Zolnierkiewicz, Tomasz Figa, Arnd Bergmann,
	Olof Johansson, Alim Akhtar, Chanwoo Choi, Pankaj Dubey

On Fri, Sep 17, 2021 at 07:51:33PM +0200, Krzysztof Kozlowski wrote:
> In case if soc-bus drivers are modules soc_device_to_device() has to be
> exported.  Since it is trivial, export it as non-GPL.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---
>  drivers/base/soc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/base/soc.c b/drivers/base/soc.c
> index 0af5363a582c..ac8db303daa1 100644
> --- a/drivers/base/soc.c
> +++ b/drivers/base/soc.c
> @@ -41,6 +41,7 @@ struct device *soc_device_to_device(struct soc_device *soc_dev)
>  {
>  	return &soc_dev->dev;
>  }
> +EXPORT_SYMBOL(soc_device_to_device);

I thought we were getting rid of the use of this function, why export it
and not just fix it up instead?

Or am I confused about some other soc device abuse...

thanks,

greg k-h

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

* Re: [PATCH 1/2] soc: export soc_device_to_device symbol
  2021-09-18  7:02   ` Greg Kroah-Hartman
@ 2021-09-19  9:12     ` Krzysztof Kozlowski
  2021-09-19  9:24       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2021-09-19  9:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rafael J. Wysocki, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, Marek Szyprowski, Sylwester Nawrocki,
	Bartlomiej Zolnierkiewicz, Tomasz Figa, Arnd Bergmann,
	Olof Johansson, Alim Akhtar, Chanwoo Choi, Pankaj Dubey

On 18/09/2021 09:02, Greg Kroah-Hartman wrote:
> On Fri, Sep 17, 2021 at 07:51:33PM +0200, Krzysztof Kozlowski wrote:
>> In case if soc-bus drivers are modules soc_device_to_device() has to be
>> exported.  Since it is trivial, export it as non-GPL.
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>> ---
>>  drivers/base/soc.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/base/soc.c b/drivers/base/soc.c
>> index 0af5363a582c..ac8db303daa1 100644
>> --- a/drivers/base/soc.c
>> +++ b/drivers/base/soc.c
>> @@ -41,6 +41,7 @@ struct device *soc_device_to_device(struct soc_device *soc_dev)
>>  {
>>  	return &soc_dev->dev;
>>  }
>> +EXPORT_SYMBOL(soc_device_to_device);
> 
> I thought we were getting rid of the use of this function, why export it
> and not just fix it up instead?
> 
> Or am I confused about some other soc device abuse...

I was not aware of discussion about soc_device_to_device(). Thanks for
pointing out the issue. I googled a little and found previous talks:
https://lore.kernel.org/lkml/20191111052741.GB3176397@kroah.com/

I can easily get rid of soc_device_to_device() in my driver, so first
patch won't be needed.

Best regards,
Krzysztof

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

* Re: [PATCH 1/2] soc: export soc_device_to_device symbol
  2021-09-19  9:12     ` Krzysztof Kozlowski
@ 2021-09-19  9:24       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2021-09-19  9:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Rafael J. Wysocki, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, Marek Szyprowski, Sylwester Nawrocki,
	Bartlomiej Zolnierkiewicz, Tomasz Figa, Arnd Bergmann,
	Olof Johansson, Alim Akhtar, Chanwoo Choi, Pankaj Dubey

On Sun, Sep 19, 2021 at 11:12:29AM +0200, Krzysztof Kozlowski wrote:
> On 18/09/2021 09:02, Greg Kroah-Hartman wrote:
> > On Fri, Sep 17, 2021 at 07:51:33PM +0200, Krzysztof Kozlowski wrote:
> >> In case if soc-bus drivers are modules soc_device_to_device() has to be
> >> exported.  Since it is trivial, export it as non-GPL.
> >>
> >> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> >> ---
> >>  drivers/base/soc.c | 1 +
> >>  1 file changed, 1 insertion(+)
> >>
> >> diff --git a/drivers/base/soc.c b/drivers/base/soc.c
> >> index 0af5363a582c..ac8db303daa1 100644
> >> --- a/drivers/base/soc.c
> >> +++ b/drivers/base/soc.c
> >> @@ -41,6 +41,7 @@ struct device *soc_device_to_device(struct soc_device *soc_dev)
> >>  {
> >>  	return &soc_dev->dev;
> >>  }
> >> +EXPORT_SYMBOL(soc_device_to_device);
> > 
> > I thought we were getting rid of the use of this function, why export it
> > and not just fix it up instead?
> > 
> > Or am I confused about some other soc device abuse...
> 
> I was not aware of discussion about soc_device_to_device(). Thanks for
> pointing out the issue. I googled a little and found previous talks:
> https://lore.kernel.org/lkml/20191111052741.GB3176397@kroah.com/
> 
> I can easily get rid of soc_device_to_device() in my driver, so first
> patch won't be needed.

Wonderful, thanks for fixing that up.

greg k-h

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

* Re: [PATCH 2/2] soc: samsung: exynos-chipid: convert to a module
  2021-09-17 17:51 ` [PATCH 2/2] soc: samsung: exynos-chipid: convert to a module Krzysztof Kozlowski
@ 2021-10-05 12:03   ` Sam Protsenko
  0 siblings, 0 replies; 7+ messages in thread
From: Sam Protsenko @ 2021-10-05 12:03 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Linux Kernel Mailing List,
	linux-arm Mailing List, Linux Samsung SOC, Marek Szyprowski,
	Sylwester Nawrocki, Bartlomiej Zolnierkiewicz, Tomasz Figa,
	Arnd Bergmann, Olof Johansson, Alim Akhtar, Chanwoo Choi,
	Pankaj Dubey

On Fri, 17 Sept 2021 at 20:51, Krzysztof Kozlowski
<krzysztof.kozlowski@canonical.com> wrote:
>
> Exynos ChipID and ASV (Adaptive Supply Voltage) driver is not essential
> to system boot and it can successfully be built and loaded as module.
>
> This makes core kernel image smaller and reduces the memory footprint
> when multi-platform kernel is booted on non-Exynos board.  Usually it is
> also distro-friendly.
>
> Add multiple authors of the driver since its conversion from
> mach-exynos, ordered alphabetically by first name.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> ---

Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org>

>  drivers/soc/samsung/Kconfig          |  3 ++-
>  drivers/soc/samsung/Makefile         |  3 ++-
>  drivers/soc/samsung/exynos-chipid.c  | 11 ++++++++++-
>  drivers/soc/samsung/exynos5422-asv.c |  1 +
>  4 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig
> index 1f643c0f5c93..fe139f26d093 100644
> --- a/drivers/soc/samsung/Kconfig
> +++ b/drivers/soc/samsung/Kconfig
> @@ -13,13 +13,14 @@ config EXYNOS_ASV_ARM
>         depends on EXYNOS_CHIPID
>
>  config EXYNOS_CHIPID
> -       bool "Exynos ChipID controller and ASV driver" if COMPILE_TEST
> +       tristate "Exynos ChipID controller and ASV driver" if COMPILE_TEST
>         depends on ARCH_EXYNOS || COMPILE_TEST
>         select EXYNOS_ASV_ARM if ARM && ARCH_EXYNOS
>         select MFD_SYSCON
>         select SOC_BUS
>         help
>           Support for Samsung Exynos SoC ChipID and Adaptive Supply Voltage.
> +         This driver can also be built as module (exynos_chipid).
>
>  config EXYNOS_PMU
>         bool "Exynos PMU controller driver" if COMPILE_TEST
> diff --git a/drivers/soc/samsung/Makefile b/drivers/soc/samsung/Makefile
> index 0c523a8de4eb..2ae4bea804cf 100644
> --- a/drivers/soc/samsung/Makefile
> +++ b/drivers/soc/samsung/Makefile
> @@ -1,8 +1,9 @@
>  # SPDX-License-Identifier: GPL-2.0
>
>  obj-$(CONFIG_EXYNOS_ASV_ARM)   += exynos5422-asv.o
> +obj-$(CONFIG_EXYNOS_CHIPID)    += exynos_chipid.o
> +exynos_chipid-y                        += exynos-chipid.o exynos-asv.o
>
> -obj-$(CONFIG_EXYNOS_CHIPID)    += exynos-chipid.o exynos-asv.o
>  obj-$(CONFIG_EXYNOS_PMU)       += exynos-pmu.o
>
>  obj-$(CONFIG_EXYNOS_PMU_ARM_DRIVERS)   += exynos3250-pmu.o exynos4-pmu.o \
> diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c
> index 5c1d0f97f766..5e8c957231ff 100644
> --- a/drivers/soc/samsung/exynos-chipid.c
> +++ b/drivers/soc/samsung/exynos-chipid.c
> @@ -15,6 +15,7 @@
>  #include <linux/device.h>
>  #include <linux/errno.h>
>  #include <linux/mfd/syscon.h>
> +#include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/platform_device.h>
>  #include <linux/regmap.h>
> @@ -129,6 +130,7 @@ static const struct of_device_id exynos_chipid_of_device_ids[] = {
>         { .compatible = "samsung,exynos4210-chipid" },
>         {}
>  };
> +MODULE_DEVICE_TABLE(of, exynos_chipid_of_device_ids);
>
>  static struct platform_driver exynos_chipid_driver = {
>         .driver = {
> @@ -138,4 +140,11 @@ static struct platform_driver exynos_chipid_driver = {
>         .probe  = exynos_chipid_probe,
>         .remove = exynos_chipid_remove,
>  };
> -builtin_platform_driver(exynos_chipid_driver);
> +module_platform_driver(exynos_chipid_driver);
> +
> +MODULE_DESCRIPTION("Samsung Exynos ChipID controller and ASV driver");

Just curious, how exactly ASV is related to chip-id driver?

> +MODULE_AUTHOR("Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>");
> +MODULE_AUTHOR("Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>");
> +MODULE_AUTHOR("Pankaj Dubey <pankaj.dubey@samsung.com>");
> +MODULE_AUTHOR("Sylwester Nawrocki <s.nawrocki@samsung.com>");
> +MODULE_LICENSE("GPL");
> diff --git a/drivers/soc/samsung/exynos5422-asv.c b/drivers/soc/samsung/exynos5422-asv.c
> index ca409a976e34..475ae5276529 100644
> --- a/drivers/soc/samsung/exynos5422-asv.c
> +++ b/drivers/soc/samsung/exynos5422-asv.c
> @@ -503,3 +503,4 @@ int exynos5422_asv_init(struct exynos_asv *asv)
>
>         return 0;
>  }
> +EXPORT_SYMBOL_GPL(exynos5422_asv_init);
> --
> 2.30.2
>

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

end of thread, other threads:[~2021-10-05 12:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-17 17:51 [PATCH 0/2] soc: samsung: be a module! Krzysztof Kozlowski
2021-09-17 17:51 ` [PATCH 1/2] soc: export soc_device_to_device symbol Krzysztof Kozlowski
2021-09-18  7:02   ` Greg Kroah-Hartman
2021-09-19  9:12     ` Krzysztof Kozlowski
2021-09-19  9:24       ` Greg Kroah-Hartman
2021-09-17 17:51 ` [PATCH 2/2] soc: samsung: exynos-chipid: convert to a module Krzysztof Kozlowski
2021-10-05 12:03   ` Sam Protsenko

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