diff mbox series

[v3,10/32] mfd: sec: merge separate core and irq modules

Message ID 20250403-s2mpg10-v3-10-b542b3505e68@linaro.org (mailing list archive)
State New
Headers show
Series Samsung S2MPG10 PMIC MFD-based drivers | expand

Commit Message

André Draszik April 3, 2025, 8:59 a.m. UTC
There is no reason to have these two kernel modules separate. Having
them merged into one kernel module also slightly reduces memory
consumption and module load times a little.

mapped size (lsmod):
         before:             after:
    sec_core   20480    sec_core   24576
    sec_irq    16384
    ----------------
    total      36864

Section sizes (size -A):
         before:             after:
    sec_core    6780    sec_core   13239
    sec_irq     8046
    ----------------
    Total      14826

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: André Draszik <andre.draszik@linaro.org>
---
Checkpatch suggests to update MAINTAINERS, but the new file is covered
already due to using a wildcard.
---
 drivers/mfd/Makefile                     | 3 ++-
 drivers/mfd/{sec-core.c => sec-common.c} | 2 ++
 drivers/mfd/sec-irq.c                    | 9 ---------
 3 files changed, 4 insertions(+), 10 deletions(-)

Comments

Lee Jones April 4, 2025, 9:21 a.m. UTC | #1
On Thu, 03 Apr 2025, André Draszik wrote:

> There is no reason to have these two kernel modules separate. Having
> them merged into one kernel module also slightly reduces memory
> consumption and module load times a little.
> 
> mapped size (lsmod):
>          before:             after:
>     sec_core   20480    sec_core   24576
>     sec_irq    16384
>     ----------------
>     total      36864
> 
> Section sizes (size -A):
>          before:             after:
>     sec_core    6780    sec_core   13239
>     sec_irq     8046
>     ----------------
>     Total      14826
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: André Draszik <andre.draszik@linaro.org>
> ---
> Checkpatch suggests to update MAINTAINERS, but the new file is covered
> already due to using a wildcard.
> ---
>  drivers/mfd/Makefile                     | 3 ++-
>  drivers/mfd/{sec-core.c => sec-common.c} | 2 ++

Okay, but why the name change?

>  drivers/mfd/sec-irq.c                    | 9 ---------
>  3 files changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> index b617782eca436e34084a9cd24c309801c5680390..8f315298b32a2a9ee114ed5e49e760bd8f930aee 100644
> --- a/drivers/mfd/Makefile
> +++ b/drivers/mfd/Makefile
> @@ -228,7 +228,8 @@ obj-$(CONFIG_MFD_RK8XX)		+= rk8xx-core.o
>  obj-$(CONFIG_MFD_RK8XX_I2C)	+= rk8xx-i2c.o
>  obj-$(CONFIG_MFD_RK8XX_SPI)	+= rk8xx-spi.o
>  obj-$(CONFIG_MFD_RN5T618)	+= rn5t618.o
> -obj-$(CONFIG_MFD_SEC_CORE)	+= sec-core.o sec-irq.o
> +sec-core-objs			:= sec-common.o sec-irq.o
> +obj-$(CONFIG_MFD_SEC_CORE)	+= sec-core.o
>  obj-$(CONFIG_MFD_SEC_ACPM)	+= sec-acpm.o
>  obj-$(CONFIG_MFD_SEC_I2C)	+= sec-i2c.o
>  obj-$(CONFIG_MFD_SYSCON)	+= syscon.o
> diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-common.c
> similarity index 98%
> rename from drivers/mfd/sec-core.c
> rename to drivers/mfd/sec-common.c
> index c4b7abe511090d8f5ff2eb501f325cc8173b9bf5..782dec1956a5fd7bf0dbb2159f9d222ad3fea942 100644
> --- a/drivers/mfd/sec-core.c
> +++ b/drivers/mfd/sec-common.c
> @@ -307,6 +307,8 @@ static int sec_pmic_resume(struct device *dev)
>  DEFINE_SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume);
>  EXPORT_SYMBOL_GPL(sec_pmic_pm_ops);
>  
> +MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>");
> +MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>");
>  MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
>  MODULE_DESCRIPTION("Core driver for the Samsung S5M");
>  MODULE_LICENSE("GPL");
> diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
> index bf86281401ac6ff05c90c2d71c84744709ed79cb..aa467e488fb5ef79d5bc7110e1ba7c26fcfa9892 100644
> --- a/drivers/mfd/sec-irq.c
> +++ b/drivers/mfd/sec-irq.c
> @@ -6,7 +6,6 @@
>  #include <linux/array_size.h>
>  #include <linux/build_bug.h>
>  #include <linux/dev_printk.h>
> -#include <linux/export.h>
>  #include <linux/interrupt.h>
>  #include <linux/irq.h>
>  #include <linux/mfd/samsung/core.h>
> @@ -17,7 +16,6 @@
>  #include <linux/mfd/samsung/s2mpu02.h>
>  #include <linux/mfd/samsung/s2mpu05.h>
>  #include <linux/mfd/samsung/s5m8767.h>
> -#include <linux/module.h>
>  #include <linux/regmap.h>
>  #include "sec-core.h"
>  
> @@ -510,10 +508,3 @@ int sec_irq_init(struct sec_pmic_dev *sec_pmic)
>  
>  	return 0;
>  }
> -EXPORT_SYMBOL_GPL(sec_irq_init);
> -
> -MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
> -MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>");
> -MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>");
> -MODULE_DESCRIPTION("Interrupt support for the S5M MFD");
> -MODULE_LICENSE("GPL");
> 
> -- 
> 2.49.0.472.ge94155a9ec-goog
>
André Draszik April 5, 2025, 1:45 p.m. UTC | #2
On Fri, 2025-04-04 at 10:21 +0100, Lee Jones wrote:
> On Thu, 03 Apr 2025, André Draszik wrote:
> 
> > There is no reason to have these two kernel modules separate. Having
> > them merged into one kernel module also slightly reduces memory
> > consumption and module load times a little.
> > 
> > mapped size (lsmod):
> >          before:             after:
> >     sec_core   20480    sec_core   24576
> >     sec_irq    16384
> >     ----------------
> >     total      36864
> > 
> > Section sizes (size -A):
> >          before:             after:
> >     sec_core    6780    sec_core   13239
> >     sec_irq     8046
> >     ----------------
> >     Total      14826
> > 
> > Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> > Signed-off-by: André Draszik <andre.draszik@linaro.org>
> > ---
> > Checkpatch suggests to update MAINTAINERS, but the new file is covered
> > already due to using a wildcard.
> > ---
> >  drivers/mfd/Makefile                     | 3 ++-
> >  drivers/mfd/{sec-core.c => sec-common.c} | 2 ++
> 
> Okay, but why the name change?

Because I wanted to keep sec-core.ko. But with kbuild, you can't generate
sec-core.ko from sec-core.c and additional files. Either just one file,
sec-core.c, or multiple files none of which may be called sec-core.c

> 
> >  drivers/mfd/sec-irq.c                    | 9 ---------
> >  3 files changed, 4 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
> > index b617782eca436e34084a9cd24c309801c5680390..8f315298b32a2a9ee114ed5e49e760bd8f930aee 100644
> > --- a/drivers/mfd/Makefile
> > +++ b/drivers/mfd/Makefile
> > @@ -228,7 +228,8 @@ obj-$(CONFIG_MFD_RK8XX)		+= rk8xx-core.o
> >  obj-$(CONFIG_MFD_RK8XX_I2C)	+= rk8xx-i2c.o
> >  obj-$(CONFIG_MFD_RK8XX_SPI)	+= rk8xx-spi.o
> >  obj-$(CONFIG_MFD_RN5T618)	+= rn5t618.o
> > -obj-$(CONFIG_MFD_SEC_CORE)	+= sec-core.o sec-irq.o
> > +sec-core-objs			:= sec-common.o sec-irq.o
> > +obj-$(CONFIG_MFD_SEC_CORE)	+= sec-core.o

Unless I'm missing some trick.

Cheers,
Andre'
diff mbox series

Patch

diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index b617782eca436e34084a9cd24c309801c5680390..8f315298b32a2a9ee114ed5e49e760bd8f930aee 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -228,7 +228,8 @@  obj-$(CONFIG_MFD_RK8XX)		+= rk8xx-core.o
 obj-$(CONFIG_MFD_RK8XX_I2C)	+= rk8xx-i2c.o
 obj-$(CONFIG_MFD_RK8XX_SPI)	+= rk8xx-spi.o
 obj-$(CONFIG_MFD_RN5T618)	+= rn5t618.o
-obj-$(CONFIG_MFD_SEC_CORE)	+= sec-core.o sec-irq.o
+sec-core-objs			:= sec-common.o sec-irq.o
+obj-$(CONFIG_MFD_SEC_CORE)	+= sec-core.o
 obj-$(CONFIG_MFD_SEC_ACPM)	+= sec-acpm.o
 obj-$(CONFIG_MFD_SEC_I2C)	+= sec-i2c.o
 obj-$(CONFIG_MFD_SYSCON)	+= syscon.o
diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-common.c
similarity index 98%
rename from drivers/mfd/sec-core.c
rename to drivers/mfd/sec-common.c
index c4b7abe511090d8f5ff2eb501f325cc8173b9bf5..782dec1956a5fd7bf0dbb2159f9d222ad3fea942 100644
--- a/drivers/mfd/sec-core.c
+++ b/drivers/mfd/sec-common.c
@@ -307,6 +307,8 @@  static int sec_pmic_resume(struct device *dev)
 DEFINE_SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume);
 EXPORT_SYMBOL_GPL(sec_pmic_pm_ops);
 
+MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>");
+MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>");
 MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
 MODULE_DESCRIPTION("Core driver for the Samsung S5M");
 MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/sec-irq.c b/drivers/mfd/sec-irq.c
index bf86281401ac6ff05c90c2d71c84744709ed79cb..aa467e488fb5ef79d5bc7110e1ba7c26fcfa9892 100644
--- a/drivers/mfd/sec-irq.c
+++ b/drivers/mfd/sec-irq.c
@@ -6,7 +6,6 @@ 
 #include <linux/array_size.h>
 #include <linux/build_bug.h>
 #include <linux/dev_printk.h>
-#include <linux/export.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/mfd/samsung/core.h>
@@ -17,7 +16,6 @@ 
 #include <linux/mfd/samsung/s2mpu02.h>
 #include <linux/mfd/samsung/s2mpu05.h>
 #include <linux/mfd/samsung/s5m8767.h>
-#include <linux/module.h>
 #include <linux/regmap.h>
 #include "sec-core.h"
 
@@ -510,10 +508,3 @@  int sec_irq_init(struct sec_pmic_dev *sec_pmic)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(sec_irq_init);
-
-MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
-MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>");
-MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>");
-MODULE_DESCRIPTION("Interrupt support for the S5M MFD");
-MODULE_LICENSE("GPL");