Skip to contentSkip to conversation

mfd: simple demodularization of non-modular drivers

PATCH Superseded Paul Gortmaker 5 participants 21 messages Nov 22, 2018 – Nov 30, 2018 1 message not in the archive

Subsystems (6)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover mfd: simple demodularization of non-modular drivers

This group of MFD drivers are all controlled by "bool" Kconfig settings, but contain traces of module infrastructure like unused/orphaned __exit functions, use of <linux/module.h> and/or MODULE_ macros that are no-ops in the non-modular case.

We can remove/replace all of the above. We are trying to make driver code consistent with the Makefiles/Kconfigs that control them. This means not using modular functions/macros for drivers that can never be built as a module. Some of the downfalls this leads to are:

(1) it is easy to accidentally write unused module_exit and remove code
(2) it can be misleading when reading the source, thinking it can be modular when the Makefile and/or Kconfig prohibit it
(3) it requires the include of the module.h header file which in turn includes nearly everything else, thus adding to CPP overhead.
(4) it gets copied/replicated into other drivers and spreads quickly.

The changes here should represent zero runtime changes. Only the ones with removed __exit functions will have a slightly smaller object size. The source gets a net reduction of 100+ lines of unused code.

Build testing was done on drivers/mfd for allyesconfig on x86_64, ARM and ARM-64.

Paul.

---

Cc Arnd Bergmann <[email protected]>
Cc Cory Maccarrone <[email protected]>
Cc Dong Aisheng <[email protected]>
Cc Graeme Gregory <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Haojian Zhuang <[email protected]>
Cc Jorge Eduardo Candelaria <[email protected]>
Cc Laxman Dewangan <[email protected]>
Cc Lee Jones <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Mattias Nilsson <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Support Opensource <[email protected]>

Paul Gortmaker (11):
mfd: as3711: Make it explicitly non-modular
mfd: da9055-core: make it explicitly non-modular
mfd: db8500-prcmu: drop unused MODULE_ tags from non-modular code
mfd: htc-i2cpld: Make it explicitly non-modular
mfd: max8925-core: drop unused MODULE_ tags from non-modular code
mfd: rc5t583: Make it explicitly non-modular
mfd: sta2x11: drop unused MODULE_ tags from non-modular code
mfd: syscon: Make it explicitly non-modular
mfd: tps65910: Make it explicitly non-modular
mfd: wm831x-core: drop unused MODULE_ tags from non-modular code
mfd: wm8400-core: Make it explicitly non-modular

 drivers/mfd/as3711.c       | 14 --------------
 drivers/mfd/da9055-core.c  | 13 ++-----------
 drivers/mfd/db8500-prcmu.c | 10 ++++------
 drivers/mfd/htc-i2cpld.c   | 18 +-----------------
 drivers/mfd/max8925-core.c |  7 +------
 drivers/mfd/rc5t583.c      | 14 --------------
 drivers/mfd/sta2x11-mfd.c  | 10 ++++------
 drivers/mfd/syscon.c       | 12 +-----------
 drivers/mfd/tps65910.c     | 18 +-----------------
 drivers/mfd/wm831x-core.c  |  7 ++-----
 drivers/mfd/wm8400-core.c  | 18 +++---------------
 11 files changed, 19 insertions(+), 122 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/11 mfd: as3711: Make it explicitly non-modular

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_AS3711
drivers/mfd/Kconfig: bool "AMS AS3711"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Cc Lee Jones <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
---
 drivers/mfd/as3711.c | 14 --------------
 1 file changed, 14 deletions(-)
drivers/mfd/as3711.c +0 -14
index 67b12417585d..7a74a874b93c 100644
@@ -16,7 +16,6 @@
 #include <linux/kernel.h>
 #include <linux/mfd/as3711.h>
 #include <linux/mfd/core.h>
-#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
@@ -118,7 +117,6 @@ static const struct of_device_id as3711_of_match[] = {
 	{.compatible = "ams,as3711",},
 	{}
 };
-MODULE_DEVICE_TABLE(of, as3711_of_match);
 #endif
 
 static int as3711_i2c_probe(struct i2c_client *client,
@@ -202,8 +200,6 @@ static const struct i2c_device_id as3711_i2c_id[] = {
 	{}
 };
 
-MODULE_DEVICE_TABLE(i2c, as3711_i2c_id);
-
 static struct i2c_driver as3711_i2c_driver = {
 	.driver = {
 		   .name = "as3711",
@@ -219,13 +215,3 @@ static int __init as3711_i2c_init(void)
 }
 /* Initialise early */
 subsys_initcall(as3711_i2c_init);
-
-static void __exit as3711_i2c_exit(void)
-{
-	i2c_del_driver(&as3711_i2c_driver);
-}
-module_exit(as3711_i2c_exit);
-
-MODULE_AUTHOR("Guennadi Liakhovetski <[email protected]>");
-MODULE_DESCRIPTION("AS3711 PMIC driver");
-MODULE_LICENSE("GPL v2");
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/11 mfd: da9055-core: make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_DA9055
drivers/mfd/Kconfig: bool "Dialog Semiconductor DA9055 PMIC Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

The exit function deleted here wasn't even registered with module_exit, so it truly was dead code.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

We replace module.h with init.h and export.h ; the latter since the file does export some symbols

Cc Support Opensource <[email protected]>
Cc Lee Jones <[email protected]>
---
 drivers/mfd/da9055-core.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)
drivers/mfd/da9055-core.c +2 -11
index 177e65a12c12..b55f13061547 100644
@@ -11,7 +11,8 @@
  *  option) any later version.
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/device.h>
 #include <linux/input.h>
 #include <linux/irq.h>
@@ -416,13 +417,3 @@ int da9055_device_init(struct da9055 *da9055)
 	mfd_remove_devices(da9055->dev);
 	return ret;
 }
-
-void da9055_device_exit(struct da9055 *da9055)
-{
-	regmap_del_irq_chip(da9055->chip_irq, da9055->irq_data);
-	mfd_remove_devices(da9055->dev);
-}
-
-MODULE_DESCRIPTION("Core support for the DA9055 PMIC");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("David Dajun Chen <[email protected]>");
Signature · 1 line
2.7.4

A message that is not in the archive (sent off-list or not yet received): 201811231036.wIjm7GBh%[email protected]

#4 lore raw

Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular

Quoted 16 lines · [Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular] On…

Hi Paul,

I love your patch! Yet something to improve:

[auto build test ERROR on ljones-mfd/for-mfd-next]
[also build test ERROR on v4.20-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Paul-Gortmaker/mfd-simple-demodularization-of-non-modular-drivers/20181123-090206
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: i386-randconfig-s1-11191736 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 
Quoted 4 lines

All errors (new ones prefixed by >>):

   drivers/mfd/da9055-i2c.o: In function `da9055_i2c_remove':
Quoted 1 line
Quoted 1 line

drivers/mfd/da9055-i2c.c:53: undefined reference to `da9055_device_exit'

Thanks for the report -- I'll look into what causes it, why my testing didn't see it, and get an update to Lee as soon as possible.

Paul.
--

Quoted 23 lines

vim +53 drivers/mfd/da9055-i2c.c

2896434c Ashish Jangam  2012-09-14  48  
4740f73f Bill Pemberton 2012-11-19  49  static int da9055_i2c_remove(struct i2c_client *i2c)
2896434c Ashish Jangam  2012-09-14  50  {
2896434c Ashish Jangam  2012-09-14  51  	struct da9055 *da9055 = i2c_get_clientdata(i2c);
2896434c Ashish Jangam  2012-09-14  52  
2896434c Ashish Jangam  2012-09-14 @53  	da9055_device_exit(da9055);
2896434c Ashish Jangam  2012-09-14  54  
2896434c Ashish Jangam  2012-09-14  55  	return 0;
2896434c Ashish Jangam  2012-09-14  56  }
2896434c Ashish Jangam  2012-09-14  57  

:::::: The code at line 53 was first introduced by commit :::::: 2896434cf272acace1b7093d5e4ba8022ed11ac8 mfd: DA9055 core driver

:::::: TO: Ashish Jangam <[email protected]> :::::: CC: Samuel Ortiz <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

#5 lore raw

Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular

Quoted 2 lines · [Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular] On…

[Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular] On 23/11/2018 (Fri 10:21) kbuild test robot wrote:

[...]

Quoted 8 lines
Quoted 5 lines

All errors (new ones prefixed by >>):

   drivers/mfd/da9055-i2c.o: In function `da9055_i2c_remove':
Quoted 1 line
Quoted 1 line

drivers/mfd/da9055-i2c.c:53: undefined reference to `da9055_device_exit'

Thanks for the report -- I'll look into what causes it, why my testing didn't see it, and get an update to Lee as soon as possible.

OK, mystery solved. I chose this smaller subset of MFD "simple" patches from my pending queue of MFD patches - to create a reasonable sized maintainer-friendly send, based on patches with zero runtime changes.

My other pending MFD patches have a trivial runtime behavior change; deleting a ".remove" field/function - that will never be used for a non-module case, but in theory could be (pointlessly) triggered by forcing a driver unbind. (see mainline 98b72b94def9 as an example) Patches like this were left behind for a future send batch.

Unfortunately that allowed me to overlook the fact that patch #2 link depended on the below ".remove" patch (not sent) to be applied 1st.

Lee, what would you like to have happen? I can resend the queue with this patch, or I can resend with #2 being temporarily deferred until a future patch batch that has the below da9055-i2c in it, or ...

Whatever is easiest for you - let me know.

Paul.
--

From da28030dbcdcd5cb4807ad18dfa6fd4773719ad0 Mon Sep 17 00:00:00 2001
From: Paul Gortmaker <[email protected]>
Date: Sun, 6 Sep 2015 22:10:34 -0400
Subject: [PATCH] mfd: da9055-i2c: Make it explicitly non-modular

The Makefile/Kconfig currently controlling compilation of this code is:

drivers/mfd/Makefile:da9055-objs := da9055-core.o da9055-i2c.o
drivers/mfd/Makefile:obj-$(CONFIG_MFD_DA9055) += da9055.o

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

We explicitly disallow a driver unbind, since that doesn't have a sensible use case anyway, and it allows us to drop the ".remove" code for non-modular drivers.

Since module_init was not in use by this code, the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Cc Support Opensource <[email protected]>
Cc Lee Jones <[email protected]>
Cc David Dajun Chen <[email protected]>
drivers/mfd/da9055-i2c.c +2 -22
index b53e100f577c..7c66f82522f0 100644
@@ -11,7 +11,7 @@
  *
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/device.h>
 #include <linux/i2c.h>
 #include <linux/err.h>
@@ -46,15 +46,6 @@ static int da9055_i2c_probe(struct i2c_client *i2c,
 	return da9055_device_init(da9055);
 }
 
-static int da9055_i2c_remove(struct i2c_client *i2c)
-{
-	struct da9055 *da9055 = i2c_get_clientdata(i2c);
-
-	da9055_device_exit(da9055);
-
-	return 0;
-}
-
 /*
  * DO NOT change the device Ids. The naming is intentionally specific as both
  * the PMIC and CODEC parts of this chip are instantiated separately as I2C
@@ -66,7 +57,6 @@ static struct i2c_device_id da9055_i2c_id[] = {
 	{"da9055-pmic", 0},
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, da9055_i2c_id);
 
 static const struct of_device_id da9055_of_match[] = {
 	{ .compatible = "dlg,da9055-pmic", },
@@ -75,11 +65,11 @@ static const struct of_device_id da9055_of_match[] = {
 
 static struct i2c_driver da9055_i2c_driver = {
 	.probe = da9055_i2c_probe,
-	.remove = da9055_i2c_remove,
 	.id_table = da9055_i2c_id,
 	.driver = {
 		.name = "da9055-pmic",
 		.of_match_table = of_match_ptr(da9055_of_match),
+		.suppress_bind_attrs = true,
 	},
 };
 
@@ -96,13 +86,3 @@ static int __init da9055_i2c_init(void)
 	return 0;
 }
 subsys_initcall(da9055_i2c_init);
-
-static void __exit da9055_i2c_exit(void)
-{
-	i2c_del_driver(&da9055_i2c_driver);
-}
-module_exit(da9055_i2c_exit);
-
-MODULE_AUTHOR("David Dajun Chen <[email protected]>");
-MODULE_DESCRIPTION("I2C driver for Dialog DA9055 PMIC");
-MODULE_LICENSE("GPL");
Signature · 1 line
2.8.0
#6 lore raw

Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular

Quoted 20 lines · Paul Gortmaker
Quoted 2 lines · [Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular] On…

[Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular] On 23/11/2018 (Fri 10:21) kbuild test robot wrote:

[...]

Quoted 8 lines
Quoted 5 lines

All errors (new ones prefixed by >>):

   drivers/mfd/da9055-i2c.o: In function `da9055_i2c_remove':
Quoted 1 line
Quoted 1 line

drivers/mfd/da9055-i2c.c:53: undefined reference to `da9055_device_exit'

Thanks for the report -- I'll look into what causes it, why my testing didn't see it, and get an update to Lee as soon as possible.

OK, mystery solved. I chose this smaller subset of MFD "simple" patches from my pending queue of MFD patches - to create a reasonable sized maintainer-friendly send, based on patches with zero runtime changes.

Quoted 5 lines

My other pending MFD patches have a trivial runtime behavior change; deleting a ".remove" field/function - that will never be used for a non-module case, but in theory could be (pointlessly) triggered by forcing a driver unbind. (see mainline 98b72b94def9 as an example) Patches like this were left behind for a future send batch.

What about when .remove() is invoked during shutdown?

Quoted 10 lines

Unfortunately that allowed me to overlook the fact that patch #2 link depended on the below ".remove" patch (not sent) to be applied 1st.

Lee, what would you like to have happen? I can resend the queue with this patch, or I can resend with #2 being temporarily deferred until a future patch batch that has the below da9055-i2c in it, or ...

Whatever is easiest for you - let me know.

Paul.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#7 lore raw

Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular

Quoted 1 line · [Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular] On…

On Fri, 23 Nov 2018, Paul Gortmaker wrote:

[...]

Quoted 7 lines
Quoted 5 lines

My other pending MFD patches have a trivial runtime behavior change; deleting a ".remove" field/function - that will never be used for a non-module case, but in theory could be (pointlessly) triggered by forcing a driver unbind. (see mainline 98b72b94def9 as an example) Patches like this were left behind for a future send batch.

What about when .remove() is invoked during shutdown?

It is my understanding that .remove is not invoked during shutdown.

If we step outside of MFD and look at mainline commit 7aa8619a66aea5 ("iommu/arm-smmu-v3: Implement shutdown method") -- you can see it adds a shutdown that is just a wrapper around the remove function.

If shutdown called remove, then this commit would cause the remove function to get called *twice* on a shutdown.

I also don't see any obvious coupling in drivers/base/platform.c - they seem independent, but it is possible I've overlooked something?

Thanks,
Paul.

----------
static int platform_drv_remove(struct device *_dev)

{
        struct platform_driver *drv = to_platform_driver(_dev->driver);
        struct platform_device *dev = to_platform_device(_dev);
        int ret = 0;

        if (drv->remove)
                ret = drv->remove(dev);
        dev_pm_domain_detach(_dev, true);

        return ret;
}

static void platform_drv_shutdown(struct device *_dev)

{
        struct platform_driver *drv = to_platform_driver(_dev->driver);
        struct platform_device *dev = to_platform_device(_dev);

        if (drv->shutdown)
                drv->shutdown(dev);
}

----------

#8 lore raw

Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular

In reply to Paul Gortmaker
Quoted 26 lines · Paul Gortmaker
Quoted 2 lines · [Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular] On…

[Re: [PATCH 02/11] mfd: da9055-core: make it explicitly non-modular] On 23/11/2018 (Fri 10:21) kbuild test robot wrote:

[...]

Quoted 8 lines
Quoted 5 lines

All errors (new ones prefixed by >>):

   drivers/mfd/da9055-i2c.o: In function `da9055_i2c_remove':
Quoted 1 line
Quoted 1 line

drivers/mfd/da9055-i2c.c:53: undefined reference to `da9055_device_exit'

Thanks for the report -- I'll look into what causes it, why my testing didn't see it, and get an update to Lee as soon as possible.

OK, mystery solved. I chose this smaller subset of MFD "simple" patches from my pending queue of MFD patches - to create a reasonable sized maintainer-friendly send, based on patches with zero runtime changes.

My other pending MFD patches have a trivial runtime behavior change; deleting a ".remove" field/function - that will never be used for a non-module case, but in theory could be (pointlessly) triggered by forcing a driver unbind. (see mainline 98b72b94def9 as an example) Patches like this were left behind for a future send batch.

Quoted 8 lines

Unfortunately that allowed me to overlook the fact that patch #2 link depended on the below ".remove" patch (not sent) to be applied 1st.

Lee, what would you like to have happen? I can resend the queue with this patch, or I can resend with #2 being temporarily deferred until a future patch batch that has the below da9055-i2c in it, or ...

Whatever is easiest for you - let me know.

Just send them all.

I'm going to have to review them all at one time or another.

Signature · 4 lines
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#9 lore raw

PATCH 3/11 mfd: db8500-prcmu: drop unused MODULE_ tags from non-modular code

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_DB8500_PRCMU
drivers/mfd/Kconfig: bool "ST-Ericsson DB8500 Power Reset Control Management Unit"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

We replace module.h with init.h and export.h ; the latter since the file does export some symbols.

Cc Linus Walleij <[email protected]>
Cc Lee Jones <[email protected]>
Cc Mattias Nilsson <[email protected]>
---
 drivers/mfd/db8500-prcmu.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/mfd/db8500-prcmu.c +4 -6
index aec20e1c7d3d..65666b624ae8 100644
@@ -1,4 +1,6 @@
 /*
+ * DB8500 PRCM Unit driver
+ *
  * Copyright (C) STMicroelectronics 2009
  * Copyright (C) ST-Ericsson SA 2010
  *
@@ -10,7 +12,8 @@
  * U8500 PRCM Unit interface driver
  *
  */
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/kernel.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
@@ -3188,9 +3191,4 @@ static int __init db8500_prcmu_init(void)
 {
 	return platform_driver_register(&db8500_prcmu_driver);
 }
-
 core_initcall(db8500_prcmu_init);
-
-MODULE_AUTHOR("Mattias Nilsson <[email protected]>");
-MODULE_DESCRIPTION("DB8500 PRCM Unit driver");
-MODULE_LICENSE("GPL v2");
Signature · 1 line
2.7.4
Reviewed-by on v1 3/11
#10 lore raw

Re: [PATCH 03/11] mfd: db8500-prcmu: drop unused MODULE_ tags from non-modular code

Quoted 13 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_DB8500_PRCMU
drivers/mfd/Kconfig: bool "ST-Ericsson DB8500 Power Reset Control Management Unit"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Quoted 7 lines

We replace module.h with init.h and export.h ; the latter since the file does export some symbols.

Cc Linus Walleij <[email protected]>
Cc Lee Jones <[email protected]>
Cc Mattias Nilsson <[email protected]>

Yours,
Linus Walleij

#11 lore raw

PATCH 4/11 mfd: htc-i2cpld: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig for this option is currently:

config HTC_I2CPLD
bool "HTC I2C PLD chip support"

...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Cc Cory Maccarrone <[email protected]>
Cc Lee Jones <[email protected]>
---
 drivers/mfd/htc-i2cpld.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/mfd/htc-i2cpld.c +1 -17
index 01572b5e79e8..af3c66355270 100644
@@ -27,7 +27,6 @@
 
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
@@ -614,8 +613,6 @@ static const struct i2c_device_id htcpld_chip_id[] = {
 	{ "htcpld-chip", 0 },
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, htcpld_chip_id);
-
 
 static struct i2c_driver htcpld_chip_driver = {
 	.driver = {
@@ -643,17 +640,4 @@ static int __init htcpld_core_init(void)
 	/* Probe for our chips */
 	return platform_driver_probe(&htcpld_core_driver, htcpld_core_probe);
 }
-
-static void __exit htcpld_core_exit(void)
-{
-	i2c_del_driver(&htcpld_chip_driver);
-	platform_driver_unregister(&htcpld_core_driver);
-}
-
-module_init(htcpld_core_init);
-module_exit(htcpld_core_exit);
-
-MODULE_AUTHOR("Cory Maccarrone <[email protected]>");
-MODULE_DESCRIPTION("I2C HTC PLD Driver");
-MODULE_LICENSE("GPL");
-
+device_initcall(htcpld_core_init);
Signature · 1 line
2.7.4
#12 lore raw

PATCH 5/11 mfd: max8925-core: drop unused MODULE_ tags from non-modular code

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_MAX8925
drivers/mfd/Kconfig: bool "Maxim Semiconductor MAX8925 PMIC Support"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Cc Lee Jones <[email protected]>
Cc Haojian Zhuang <[email protected]>
---
 drivers/mfd/max8925-core.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/mfd/max8925-core.c +1 -6
index fd8b15cd84fd..87c724ba9793 100644
@@ -10,7 +10,7 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
@@ -919,8 +919,3 @@ void max8925_device_exit(struct max8925_chip *chip)
 		free_irq(chip->tsc_irq, chip);
 	mfd_remove_devices(chip->dev);
 }
-
-
-MODULE_DESCRIPTION("PMIC Driver for Maxim MAX8925");
-MODULE_AUTHOR("Haojian Zhuang <[email protected]");
-MODULE_LICENSE("GPL");
Signature · 1 line
2.7.4
#13 lore raw

PATCH 6/11 mfd: rc5t583: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_RC5T583
drivers/mfd/Kconfig: bool "Ricoh RC5T583 Power Management system device"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Cc Lee Jones <[email protected]>
Cc Laxman Dewangan <[email protected]>
---
 drivers/mfd/rc5t583.c | 14 --------------
 1 file changed, 14 deletions(-)
drivers/mfd/rc5t583.c +0 -14
index fd46de02b715..c5cc5cb3dde7 100644
@@ -23,7 +23,6 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/slab.h>
@@ -298,8 +297,6 @@ static const struct i2c_device_id rc5t583_i2c_id[] = {
 	{}
 };
 
-MODULE_DEVICE_TABLE(i2c, rc5t583_i2c_id);
-
 static struct i2c_driver rc5t583_i2c_driver = {
 	.driver = {
 		   .name = "rc5t583",
@@ -313,14 +310,3 @@ static int __init rc5t583_i2c_init(void)
 	return i2c_add_driver(&rc5t583_i2c_driver);
 }
 subsys_initcall(rc5t583_i2c_init);
-
-static void __exit rc5t583_i2c_exit(void)
-{
-	i2c_del_driver(&rc5t583_i2c_driver);
-}
-
-module_exit(rc5t583_i2c_exit);
-
-MODULE_AUTHOR("Laxman Dewangan <[email protected]>");
-MODULE_DESCRIPTION("RICOH RC5T583 power management system device driver");
-MODULE_LICENSE("GPL v2");
Signature · 1 line
2.7.4
#14 lore raw

PATCH 7/11 mfd: sta2x11: drop unused MODULE_ tags from non-modular code

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_STA2X11
drivers/mfd/Kconfig: bool "STMicroelectronics STA2X11"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

We replace module.h with init.h and export.h ; the latter since the file does export some symbols.

---
 drivers/mfd/sta2x11-mfd.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/mfd/sta2x11-mfd.c +4 -6
index 3aeafa228baf..cab9aabcaa1f 100644
@@ -1,4 +1,6 @@
 /*
+ * STA2x11 mfd for GPIO, SCTL and APBREG
+ *
  * Copyright (c) 2009-2011 Wind River Systems, Inc.
  * Copyright (c) 2011 ST Microelectronics (Alessandro Rubini, Davide Ciminaghi)
  *
@@ -18,7 +20,8 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/spinlock.h>
 #include <linux/errno.h>
 #include <linux/device.h>
@@ -653,8 +656,3 @@ static int __init sta2x11_mfd_init(void)
  */
 subsys_initcall(sta2x11_drivers_init);
 rootfs_initcall(sta2x11_mfd_init);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Wind River");
-MODULE_DESCRIPTION("STA2x11 mfd for GPIO, SCTL and APBREG");
-MODULE_DEVICE_TABLE(pci, sta2x11_mfd_tbl);
Signature · 1 line
2.7.4
#15 lore raw

PATCH 8/11 mfd: syscon: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_SYSCON
drivers/mfd/Kconfig: bool "System Controller Register R/W Based on Regmap"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering remains unchanged with this commit.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Cc Lee Jones <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Dong Aisheng <[email protected]>
---
 drivers/mfd/syscon.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/mfd/syscon.c +1 -11
index b6d05cd934e6..0ecdffb3d967 100644
@@ -15,7 +15,7 @@
 #include <linux/err.h>
 #include <linux/hwspinlock.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/list.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -272,13 +272,3 @@ static int __init syscon_init(void)
 	return platform_driver_register(&syscon_driver);
 }
 postcore_initcall(syscon_init);
-
-static void __exit syscon_exit(void)
-{
-	platform_driver_unregister(&syscon_driver);
-}
-module_exit(syscon_exit);
-
-MODULE_AUTHOR("Dong Aisheng <[email protected]>");
-MODULE_DESCRIPTION("System Control driver");
-MODULE_LICENSE("GPL v2");
Signature · 1 line
2.7.4
#16 lore raw

PATCH 9/11 mfd: tps65910: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TPS65910
drivers/mfd/Kconfig- bool "TI TPS65910 Power Management chip"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering remains unchanged with this commit.

We don't replace module.h with init.h since the file already has that. We do delete an unused moduleparam.h include though.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments.

Cc Tony Lindgren <[email protected]>
Cc Lee Jones <[email protected]>
Cc Graeme Gregory <[email protected]>
Cc Jorge Eduardo Candelaria <[email protected]>
---
 drivers/mfd/tps65910.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/mfd/tps65910.c +1 -17
index bf16cbe6fd88..aa3d472a10ff 100644
@@ -1,5 +1,5 @@
 /*
- * tps65910.c  --  TI TPS6591x
+ * tps65910.c  --  TI TPS6591x chip family multi-function driver
  *
  * Copyright 2010 Texas Instruments Inc.
  *
@@ -13,8 +13,6 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/slab.h>
@@ -374,7 +372,6 @@ static const struct of_device_id tps65910_of_match[] = {
 	{ .compatible = "ti,tps65911", .data = (void *)TPS65911},
 	{ },
 };
-MODULE_DEVICE_TABLE(of, tps65910_of_match);
 
 static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
 						unsigned long *chip_id)
@@ -527,8 +524,6 @@ static const struct i2c_device_id tps65910_i2c_id[] = {
        { "tps65911", TPS65911 },
        { }
 };
-MODULE_DEVICE_TABLE(i2c, tps65910_i2c_id);
-
 
 static struct i2c_driver tps65910_i2c_driver = {
 	.driver = {
@@ -545,14 +540,3 @@ static int __init tps65910_i2c_init(void)
 }
 /* init early so consumer devices can complete system boot */
 subsys_initcall(tps65910_i2c_init);
-
-static void __exit tps65910_i2c_exit(void)
-{
-	i2c_del_driver(&tps65910_i2c_driver);
-}
-module_exit(tps65910_i2c_exit);
-
-MODULE_AUTHOR("Graeme Gregory <[email protected]>");
-MODULE_AUTHOR("Jorge Eduardo Candelaria <[email protected]>");
-MODULE_DESCRIPTION("TPS6591x chip family multi-function driver");
-MODULE_LICENSE("GPL");
Signature · 1 line
2.7.4
Acked-by on v1 9/11
#17 lore raw

Re: [PATCH 09/11] mfd: tps65910: Make it explicitly non-modular

Quoted 13 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TPS65910
drivers/mfd/Kconfig- bool "TI TPS65910 Power Management chip"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering remains unchanged with this commit.

Quoted 8 lines

We don't replace module.h with init.h since the file already has that. We do delete an unused moduleparam.h include though.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information was (or is now) contained at the top of the file in the comments.

This is all fine with me.

Thanks

Quoted 65 lines
Cc Tony Lindgren <[email protected]>
Cc Lee Jones <[email protected]>
Cc Graeme Gregory <[email protected]>
Cc Jorge Eduardo Candelaria <[email protected]>
---
 drivers/mfd/tps65910.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)
drivers/mfd/tps65910.c +1 -17
index bf16cbe6fd88..aa3d472a10ff 100644
@@ -1,5 +1,5 @@
 /*
- * tps65910.c  --  TI TPS6591x
+ * tps65910.c  --  TI TPS6591x chip family multi-function driver
  *
  * Copyright 2010 Texas Instruments Inc.
  *
@@ -13,8 +13,6 @@
  *
  */
 
-#include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/slab.h>
@@ -374,7 +372,6 @@ static const struct of_device_id tps65910_of_match[] = {
 	{ .compatible = "ti,tps65911", .data = (void *)TPS65911},
 	{ },
 };
-MODULE_DEVICE_TABLE(of, tps65910_of_match);
 
 static struct tps65910_board *tps65910_parse_dt(struct i2c_client *client,
 						unsigned long *chip_id)
@@ -527,8 +524,6 @@ static const struct i2c_device_id tps65910_i2c_id[] = {
        { "tps65911", TPS65911 },
        { }
 };
-MODULE_DEVICE_TABLE(i2c, tps65910_i2c_id);
-
 
 static struct i2c_driver tps65910_i2c_driver = {
 	.driver = {
@@ -545,14 +540,3 @@ static int __init tps65910_i2c_init(void)
 }
 /* init early so consumer devices can complete system boot */
 subsys_initcall(tps65910_i2c_init);
-
-static void __exit tps65910_i2c_exit(void)
-{
-	i2c_del_driver(&tps65910_i2c_driver);
-}
-module_exit(tps65910_i2c_exit);
-
-MODULE_AUTHOR("Graeme Gregory <[email protected]>");
-MODULE_AUTHOR("Jorge Eduardo Candelaria <[email protected]>");
-MODULE_DESCRIPTION("TPS6591x chip family multi-function driver");
-MODULE_LICENSE("GPL");
Signature · 1 line
2.7.4
#18 lore raw

PATCH 10/11 mfd: wm831x-core: drop unused MODULE_ tags from non-modular code

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM831X
drivers/mfd/Kconfig: bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that when reading the driver there is no doubt it is builtin-only.

We delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

---
 drivers/mfd/wm831x-core.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/mfd/wm831x-core.c +2 -5
index e70d35ef5c6d..d64214c78cba 100644
@@ -13,7 +13,8 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/export.h>
 #include <linux/bcd.h>
 #include <linux/delay.h>
 #include <linux/mfd/core.h>
@@ -1944,7 +1945,3 @@ void wm831x_device_shutdown(struct wm831x *wm831x)
 	}
 }
 EXPORT_SYMBOL_GPL(wm831x_device_shutdown);
-
-MODULE_DESCRIPTION("Core support for the WM831X AudioPlus PMIC");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mark Brown");
Signature · 1 line
2.7.4
Acked-by on v1 10/11
#19 lore raw

Re: [PATCH 10/11] mfd: wm831x-core: drop unused MODULE_ tags from non-modular code

Quoted 10 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM831X
drivers/mfd/Kconfig: bool

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modular infrastructure use, so that when reading the driver there is no doubt it is builtin-only.

Quoted 7 lines

We delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

---

Thanks,
Charles

#20 lore raw

PATCH 11/11 mfd: wm8400-core: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM8400
drivers/mfd/Kconfig: bool "Wolfson Microelectronics WM8400"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Finally a function is renamed to remove word "module" in order to possibly remove any confusion.

---
 drivers/mfd/wm8400-core.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
drivers/mfd/wm8400-core.c +3 -15
index 8a98a2fc74e1..79756c83f5f0 100644
@@ -12,7 +12,7 @@
  *
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/bug.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
@@ -150,7 +150,6 @@ static const struct i2c_device_id wm8400_i2c_id[] = {
        { "wm8400", 0 },
        { }
 };
-MODULE_DEVICE_TABLE(i2c, wm8400_i2c_id);
 
 static struct i2c_driver wm8400_i2c_driver = {
 	.driver = {
@@ -161,7 +160,7 @@ static struct i2c_driver wm8400_i2c_driver = {
 };
 #endif
 
-static int __init wm8400_module_init(void)
+static int __init wm8400_driver_init(void)
 {
 	int ret = -ENODEV;
 
@@ -173,15 +172,4 @@ static int __init wm8400_module_init(void)
 
 	return ret;
 }
-subsys_initcall(wm8400_module_init);
-
-static void __exit wm8400_module_exit(void)
-{
-#if IS_ENABLED(CONFIG_I2C)
-	i2c_del_driver(&wm8400_i2c_driver);
-#endif
-}
-module_exit(wm8400_module_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mark Brown <[email protected]>");
+subsys_initcall(wm8400_driver_init);
Signature · 1 line
2.7.4
Acked-by on v1 11/11
#21 lore raw

Re: [PATCH 11/11] mfd: wm8400-core: Make it explicitly non-modular

Quoted 18 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_WM8400
drivers/mfd/Kconfig: bool "Wolfson Microelectronics WM8400"

...meaning that it currently is not being built as a module by anyone.

Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only.

Since module_init was not in use by this code, the init ordering remains unchanged with this commit.

Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code.

We also delete the MODULE_LICENSE tag etc. since all that information is already contained at the top of the file in the comments.

Quoted 7 lines

Finally a function is renamed to remove word "module" in order to possibly remove any confusion.

---

Thanks,
Charles