Hi, Changes since v1 ================ 1. Drop patch 1/2 - exporting soc_device_to_device 2. Add new patches: 1/3 and 3/3. Question ======== 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 (3): soc: samsung: exynos-chipid: avoid soc_device_to_device() soc: samsung: exynos-chipid: convert to a module soc: samsung: exynos-chipid: do not enforce built-in arch/arm/mach-exynos/Kconfig | 1 - drivers/soc/samsung/Kconfig | 4 +++- drivers/soc/samsung/Makefile | 3 ++- drivers/soc/samsung/exynos-chipid.c | 14 +++++++++++--- drivers/soc/samsung/exynos5422-asv.c | 1 + 5 files changed, 17 insertions(+), 6 deletions(-) -- 2.30.2
soc_device_to_device() seems to be discouraged [1] so remove it in favor of printing info message with platform device. This will only change the prefix in theh info message from "soc soc0: " to "exynos-chipid 10000000.chipid:". [1] https://lore.kernel.org/lkml/20191111052741.GB3176397@kroah.com/ Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> --- drivers/soc/samsung/exynos-chipid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c index 5c1d0f97f766..dcd9a08ce706 100644 --- a/drivers/soc/samsung/exynos-chipid.c +++ b/drivers/soc/samsung/exynos-chipid.c @@ -104,8 +104,7 @@ static int exynos_chipid_probe(struct platform_device *pdev) platform_set_drvdata(pdev, soc_dev); - dev_info(soc_device_to_device(soc_dev), - "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n", + dev_info(&pdev->dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n", soc_dev_attr->soc_id, product_id, revision); return 0; -- 2.30.2
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 dcd9a08ce706..b2627a3a127a 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> @@ -128,6 +129,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 = { @@ -137,4 +139,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
After converting the Exynos ChipID and ASV driver to a module, allow to actually choose it to be a module, while being a default built-in. The side effect is that driver could be now entirely disabled even for kernel with ARCH_EXYNOS, but this is not a critical issue because driver is not necessary for the proper platform boot. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> --- arch/arm/mach-exynos/Kconfig | 1 - drivers/soc/samsung/Kconfig | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig index 5a48abac6af4..30f930e20599 100644 --- a/arch/arm/mach-exynos/Kconfig +++ b/arch/arm/mach-exynos/Kconfig @@ -13,7 +13,6 @@ menuconfig ARCH_EXYNOS select ARM_GIC select EXYNOS_IRQ_COMBINER select COMMON_CLK_SAMSUNG - select EXYNOS_CHIPID select EXYNOS_THERMAL select EXYNOS_PMU select EXYNOS_SROM diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig index fe139f26d093..e2cedef1e8d1 100644 --- a/drivers/soc/samsung/Kconfig +++ b/drivers/soc/samsung/Kconfig @@ -13,8 +13,9 @@ config EXYNOS_ASV_ARM depends on EXYNOS_CHIPID config EXYNOS_CHIPID - tristate "Exynos ChipID controller and ASV driver" if COMPILE_TEST + tristate "Exynos ChipID controller and ASV driver" depends on ARCH_EXYNOS || COMPILE_TEST + default ARCH_EXYNOS select EXYNOS_ASV_ARM if ARM && ARCH_EXYNOS select MFD_SYSCON select SOC_BUS -- 2.30.2
Hello Krzysztof On Sun, Sep 19, 2021 at 6:28 PM Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> wrote: > > Hi, > > Changes since v1 > ================ > 1. Drop patch 1/2 - exporting soc_device_to_device > 2. Add new patches: 1/3 and 3/3. > > Question > ======== > > 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 (3): > soc: samsung: exynos-chipid: avoid soc_device_to_device() > soc: samsung: exynos-chipid: convert to a module > soc: samsung: exynos-chipid: do not enforce built-in > > arch/arm/mach-exynos/Kconfig | 1 - > drivers/soc/samsung/Kconfig | 4 +++- > drivers/soc/samsung/Makefile | 3 ++- > drivers/soc/samsung/exynos-chipid.c | 14 +++++++++++--- > drivers/soc/samsung/exynos5422-asv.c | 1 + > 5 files changed, 17 insertions(+), 6 deletions(-) > Thanks for the patches. For this series Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> Also tested on exynos7 based platform, so Tested-by: Alim Akhtar <alim.akhtar@samsung.com> > -- > 2.30.2 > -- Regards, Alim
On 19.09.2021 11:31, Krzysztof Kozlowski wrote:
> Krzysztof Kozlowski (3):
> soc: samsung: exynos-chipid: avoid soc_device_to_device()
> soc: samsung: exynos-chipid: convert to a module
> soc: samsung: exynos-chipid: do not enforce built-in
>
> arch/arm/mach-exynos/Kconfig | 1 -
> drivers/soc/samsung/Kconfig | 4 +++-
> drivers/soc/samsung/Makefile | 3 ++-
> drivers/soc/samsung/exynos-chipid.c | 14 +++++++++++---
> drivers/soc/samsung/exynos5422-asv.c | 1 +
For the series:
Reviewed-by: Sylwester Nawrocki <snawrocki@kernel.org>
Tested-by: Sylwester Nawrocki <snawrocki@kernel.org>
I just verified Odroid-XU4 is still booting without the driver
and with the driver as a module. Thanks.
On Sun, 19 Sep 2021 11:31:11 +0200, Krzysztof Kozlowski wrote:
> Changes since v1
> ================
> 1. Drop patch 1/2 - exporting soc_device_to_device
> 2. Add new patches: 1/3 and 3/3.
>
> Question
> ========
>
> [...]
Applied, thanks!
[1/3] soc: samsung: exynos-chipid: avoid soc_device_to_device()
commit: d1141886c8d72ad77920e6e4b617d366e6e3ee8a
[2/3] soc: samsung: exynos-chipid: convert to a module
commit: 1e3e559f8d4e5b4c873414078facb35273ecbf4b
[3/3] soc: samsung: exynos-chipid: do not enforce built-in
commit: 140bbfe7cd4be0aa6543f94d3994e4774b325abc
Best regards,
--
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
On Sun, 19 Sept 2021 at 12:31, Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> wrote: > > soc_device_to_device() seems to be discouraged [1] so remove it in favor > of printing info message with platform device. This will only change > the prefix in theh info message from "soc soc0: " to "exynos-chipid > 10000000.chipid:". > > [1] https://lore.kernel.org/lkml/20191111052741.GB3176397@kroah.com/ > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> > --- Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> > drivers/soc/samsung/exynos-chipid.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c > index 5c1d0f97f766..dcd9a08ce706 100644 > --- a/drivers/soc/samsung/exynos-chipid.c > +++ b/drivers/soc/samsung/exynos-chipid.c > @@ -104,8 +104,7 @@ static int exynos_chipid_probe(struct platform_device *pdev) > > platform_set_drvdata(pdev, soc_dev); > > - dev_info(soc_device_to_device(soc_dev), > - "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n", > + dev_info(&pdev->dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n", > soc_dev_attr->soc_id, product_id, revision); > > return 0; > -- > 2.30.2 >
On Sun, 19 Sept 2021 at 12:31, 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 dcd9a08ce706..b2627a3a127a 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> > @@ -128,6 +129,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 = { > @@ -137,4 +139,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 >
On Sun, 19 Sept 2021 at 12:31, Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> wrote: > > After converting the Exynos ChipID and ASV driver to a module, allow to > actually choose it to be a module, while being a default built-in. The > side effect is that driver could be now entirely disabled even for > kernel with ARCH_EXYNOS, but this is not a critical issue because driver > is not necessary for the proper platform boot. > > Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> > --- Reviewed-by: Sam Protsenko <semen.protsenko@linaro.org> > arch/arm/mach-exynos/Kconfig | 1 - > drivers/soc/samsung/Kconfig | 3 ++- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/mach-exynos/Kconfig b/arch/arm/mach-exynos/Kconfig > index 5a48abac6af4..30f930e20599 100644 > --- a/arch/arm/mach-exynos/Kconfig > +++ b/arch/arm/mach-exynos/Kconfig > @@ -13,7 +13,6 @@ menuconfig ARCH_EXYNOS > select ARM_GIC > select EXYNOS_IRQ_COMBINER > select COMMON_CLK_SAMSUNG > - select EXYNOS_CHIPID > select EXYNOS_THERMAL > select EXYNOS_PMU > select EXYNOS_SROM > diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig > index fe139f26d093..e2cedef1e8d1 100644 > --- a/drivers/soc/samsung/Kconfig > +++ b/drivers/soc/samsung/Kconfig > @@ -13,8 +13,9 @@ config EXYNOS_ASV_ARM > depends on EXYNOS_CHIPID > > config EXYNOS_CHIPID > - tristate "Exynos ChipID controller and ASV driver" if COMPILE_TEST > + tristate "Exynos ChipID controller and ASV driver" > depends on ARCH_EXYNOS || COMPILE_TEST > + default ARCH_EXYNOS > select EXYNOS_ASV_ARM if ARM && ARCH_EXYNOS > select MFD_SYSCON > select SOC_BUS > -- > 2.30.2 >