Skip to contentSkip to conversation

mfd: demodularization of non-modular drivers

PATCH In review Paul Gortmaker 2 participants 20 messages Dec 18, 2019 – Dec 20, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover mfd: demodularization of non-modular drivers

This group of MFD drivers are all controlled by "bool" Kconfig settings, but contain module infrastructure like unused/orphaned "remove" and __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.

We've integrated hundreds of these type cleanups already, as the git history will show. This is just a continuation of that objective.

The ".remove" function linked into the device structure deserves an extra comment. While the normal execution path would be from a module unload (if it was modular), it is theoretically possible that a person could use the core driver infrastructure to manually push the driver off the hardware; an "unbind" event -- which would run the ".remove" function.

Given that, in this series, when we delete a ".remove" function from the driver struct, we also disable unbind. Should there be a valid use case out there that has been overlooked, this will ensure we get to see it and can react/revert accordingly.

Build testing was done on drivers/mfd for allmodconfig on x86_64, ARM and ARM-64 (on linux-next).

---

Cc Alexandre Torgue <[email protected]>
Cc Daniel Ribeiro <[email protected]>
Cc Graeme Gregory <[email protected]>
Cc Haojian Zhuang <[email protected]>
Cc Harald Welte <[email protected]>
Cc Ian Molton <[email protected]>
Cc Jorge Eduardo Candelaria <[email protected]>
Cc Keshava Munegowda <[email protected]>
Cc Lee Jones <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Mike Rapoport <[email protected]>
Cc Milo Kim <[email protected]>
Cc Misael Lopez Cruz <[email protected]>
Cc Peter Ujfalusi <[email protected]>
Cc Rabin Vincent <[email protected]>
Cc Roger Quadros <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Yang, Bin <[email protected]>
Cc Zhu, Lejun <[email protected]>

Paul Gortmaker (18):
mfd: stmpe-spi: Make it explicitly non-modular
mfd: stmpe-i2c: Make it explicitly non-modular
mfd: ezx-pcap: Make it explicitly non-modular
mfd: 88pm860x-*: Make it explicitly non-modular
mfd: tc3589: Make it explicitly non-modular
mfd: tc6387xb: Make it explicitly non-modular
mfd: tc6393xb: Make it explicitly non-modular
mfd: twl4030-audio: Make it explicitly non-modular
mfd: twl4030-power: Make it explicitly non-modular
mfd: twl6040: Make it explicitly non-modular
mfd: t7l66xb: Make it explicitly non-modular
mfd: lp8788: Make it explicitly non-modular
mfd: menelaus: Make it explicitly non-modular
mfd: tps6586x: Make it explicitly non-modular
mfd: omap-usb-tll: Make it explicitly non-modular
mfd: omap-usb-host: Make it explicitly non-modular
mfd: palmas: Make it explicitly non-modular
mfd: intel_soc_pmic_core: Make it explicitly non-modular

 drivers/mfd/88pm860x-core.c       | 40 ++-------------------------------
 drivers/mfd/88pm860x-i2c.c        |  1 -
 drivers/mfd/ezx-pcap.c            | 42 +++-------------------------------
 drivers/mfd/intel_soc_pmic_core.c | 31 +++-----------------------
 drivers/mfd/lp8788.c              | 24 ++------------------
 drivers/mfd/menelaus.c            | 24 ++++----------------
 drivers/mfd/omap-usb-host.c       | 47 +++++----------------------------------
 drivers/mfd/omap-usb-tll.c        | 47 ++++-----------------------------------
 drivers/mfd/palmas.c              | 36 +-----------------------------
 drivers/mfd/stmpe-i2c.c           | 23 ++-----------------
 drivers/mfd/stmpe-spi.c           | 23 ++-----------------
 drivers/mfd/stmpe.c               | 14 ------------
 drivers/mfd/stmpe.h               |  1 -
 drivers/mfd/t7l66xb.c             | 37 ++++--------------------------
 drivers/mfd/tc3589x.c             | 26 ++--------------------
 drivers/mfd/tc6387xb.c            | 30 ++++---------------------
 drivers/mfd/tc6393xb.c            | 43 ++---------------------------------
 drivers/mfd/tps6586x.c            | 26 ++--------------------
 drivers/mfd/twl4030-audio.c       | 21 +++--------------
 drivers/mfd/twl4030-power.c       | 19 +++-------------
 drivers/mfd/twl6040.c             | 29 +++---------------------
 21 files changed, 51 insertions(+), 533 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/18 mfd: stmpe-spi: Make it explicitly non-modular

drivers/mfd/Kconfig:config STMPE_SPI
drivers/mfd/Kconfig: bool "STMicroelectronics STMPE SPI Interface"

The Kconfig currently controlling compilation of this code is:

...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 Lee Jones <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Maxime Coquelin <[email protected]>
Cc Alexandre Torgue <[email protected]>
---
 drivers/mfd/stmpe-spi.c | 23 ++---------------------
 1 file changed, 2 insertions(+), 21 deletions(-)
drivers/mfd/stmpe-spi.c +2 -21
index 7351734f7593..3f6471e7301a 100644
@@ -10,7 +10,7 @@
 #include <linux/spi/spi.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/types.h>
 #include "stmpe.h"
@@ -102,13 +102,6 @@ stmpe_spi_probe(struct spi_device *spi)
 	return stmpe_probe(&spi_ci, id->driver_data);
 }
 
-static int stmpe_spi_remove(struct spi_device *spi)
-{
-	struct stmpe *stmpe = spi_get_drvdata(spi);
-
-	return stmpe_remove(stmpe);
-}
-
 static const struct of_device_id stmpe_spi_of_match[] = {
 	{ .compatible = "st,stmpe610", },
 	{ .compatible = "st,stmpe801", },
@@ -118,7 +111,6 @@ static const struct of_device_id stmpe_spi_of_match[] = {
 	{ .compatible = "st,stmpe2403", },
 	{ /* sentinel */ },
 };
-MODULE_DEVICE_TABLE(of, stmpe_spi_of_match);
 
 static const struct spi_device_id stmpe_spi_id[] = {
 	{ "stmpe610", STMPE610 },
@@ -129,18 +121,17 @@ static const struct spi_device_id stmpe_spi_id[] = {
 	{ "stmpe2403", STMPE2403 },
 	{ }
 };
-MODULE_DEVICE_TABLE(spi, stmpe_id);
 
 static struct spi_driver stmpe_spi_driver = {
 	.driver = {
 		.name	= "stmpe-spi",
 		.of_match_table = of_match_ptr(stmpe_spi_of_match),
+		.suppress_bind_attrs = true,
 #ifdef CONFIG_PM
 		.pm	= &stmpe_dev_pm_ops,
 #endif
 	},
 	.probe		= stmpe_spi_probe,
-	.remove		= stmpe_spi_remove,
 	.id_table	= stmpe_spi_id,
 };
 
@@ -149,13 +140,3 @@ static int __init stmpe_init(void)
 	return spi_register_driver(&stmpe_spi_driver);
 }
 subsys_initcall(stmpe_init);
-
-static void __exit stmpe_exit(void)
-{
-	spi_unregister_driver(&stmpe_spi_driver);
-}
-module_exit(stmpe_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("STMPE MFD SPI Interface Driver");
-MODULE_AUTHOR("Viresh Kumar <[email protected]>");
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/18 mfd: stmpe-i2c: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config STMPE_I2C
drivers/mfd/Kconfig: bool "STMicroelectronics STMPE I2C Interface"

...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. In doing so stmpe_remove itself becomes orphaned, so it gets removed too.

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. As this makes stmpe_remove an orphaned function, it gets removed too.

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 Maxime Coquelin <[email protected]>
Cc Alexandre Torgue <[email protected]>
---
 drivers/mfd/stmpe-i2c.c | 23 ++---------------------
 drivers/mfd/stmpe.c     | 14 --------------
 drivers/mfd/stmpe.h     |  1 -
 3 files changed, 2 insertions(+), 36 deletions(-)
drivers/mfd/stmpe-i2c.c +2 -21
index 61aa020199f5..9d3e9443225a 100644
@@ -12,7 +12,7 @@
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/of_device.h>
 #include "stmpe.h"
@@ -64,7 +64,6 @@ static const struct of_device_id stmpe_of_match[] = {
 	{ .compatible = "st,stmpe2403", .data = (void *)STMPE2403, },
 	{},
 };
-MODULE_DEVICE_TABLE(of, stmpe_of_match);
 
 static int
 stmpe_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
@@ -91,13 +90,6 @@ stmpe_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
 	return stmpe_probe(&i2c_ci, partnum);
 }
 
-static int stmpe_i2c_remove(struct i2c_client *i2c)
-{
-	struct stmpe *stmpe = dev_get_drvdata(&i2c->dev);
-
-	return stmpe_remove(stmpe);
-}
-
 static const struct i2c_device_id stmpe_i2c_id[] = {
 	{ "stmpe610", STMPE610 },
 	{ "stmpe801", STMPE801 },
@@ -109,7 +101,6 @@ static const struct i2c_device_id stmpe_i2c_id[] = {
 	{ "stmpe2403", STMPE2403 },
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, stmpe_id);
 
 static struct i2c_driver stmpe_i2c_driver = {
 	.driver = {
@@ -118,9 +109,9 @@ static struct i2c_driver stmpe_i2c_driver = {
 		.pm = &stmpe_dev_pm_ops,
 #endif
 		.of_match_table = stmpe_of_match,
+		.suppress_bind_attrs = true,
 	},
 	.probe		= stmpe_i2c_probe,
-	.remove		= stmpe_i2c_remove,
 	.id_table	= stmpe_i2c_id,
 };
 
@@ -129,13 +120,3 @@ static int __init stmpe_init(void)
 	return i2c_add_driver(&stmpe_i2c_driver);
 }
 subsys_initcall(stmpe_init);
-
-static void __exit stmpe_exit(void)
-{
-	i2c_del_driver(&stmpe_i2c_driver);
-}
-module_exit(stmpe_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("STMPE MFD I2C Interface Driver");
-MODULE_AUTHOR("Rabin Vincent <[email protected]>");
drivers/mfd/stmpe.c +0 -14
index 1aee3b3253fc..611f1d8243b9 100644
@@ -1492,20 +1492,6 @@ int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum)
 	return ret;
 }
 
-int stmpe_remove(struct stmpe *stmpe)
-{
-	if (!IS_ERR(stmpe->vio))
-		regulator_disable(stmpe->vio);
-	if (!IS_ERR(stmpe->vcc))
-		regulator_disable(stmpe->vcc);
-
-	__stmpe_disable(stmpe, STMPE_BLOCK_ADC);
-
-	mfd_remove_devices(stmpe->dev);
-
-	return 0;
-}
-
 #ifdef CONFIG_PM
 static int stmpe_suspend(struct device *dev)
 {
drivers/mfd/stmpe.h +0 -1
index 83491e99ba3c..ba9006b7f8f4 100644
@@ -98,7 +98,6 @@ struct stmpe_client_info {
 };
 
 int stmpe_probe(struct stmpe_client_info *ci, enum stmpe_partnum partnum);
-int stmpe_remove(struct stmpe *stmpe);
 
 #define STMPE_ICR_LSB_HIGH	(1 << 2)
 #define STMPE_ICR_LSB_EDGE	(1 << 1)
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/18 mfd: ezx-pcap: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config EZX_PCAP
drivers/mfd/Kconfig: bool "Motorola EZXPCAP 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.

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.

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 Daniel Ribeiro <[email protected]>
Cc Harald Welte <[email protected]>
---
 drivers/mfd/ezx-pcap.c | 42 +++---------------------------------------
 1 file changed, 3 insertions(+), 39 deletions(-)
drivers/mfd/ezx-pcap.c +3 -39
index 70fa18b04ad2..954a27985b2f 100644
@@ -6,7 +6,7 @@
  * Copyright (C) 2009 Daniel Ribeiro <[email protected]>
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 #include <linux/interrupt.h>
@@ -392,30 +392,6 @@ static int pcap_add_subdev(struct pcap_chip *pcap,
 	return ret;
 }
 
-static int ezx_pcap_remove(struct spi_device *spi)
-{
-	struct pcap_chip *pcap = spi_get_drvdata(spi);
-	unsigned long flags;
-	int i;
-
-	/* remove all registered subdevs */
-	device_for_each_child(&spi->dev, NULL, pcap_remove_subdev);
-
-	/* cleanup ADC */
-	spin_lock_irqsave(&pcap->adc_lock, flags);
-	for (i = 0; i < PCAP_ADC_MAXQ; i++)
-		kfree(pcap->adc_queue[i]);
-	spin_unlock_irqrestore(&pcap->adc_lock, flags);
-
-	/* cleanup irqchip */
-	for (i = pcap->irq_base; i < (pcap->irq_base + PCAP_NIRQS); i++)
-		irq_set_chip_and_handler(i, NULL, NULL);
-
-	destroy_workqueue(pcap->workqueue);
-
-	return 0;
-}
-
 static int ezx_pcap_probe(struct spi_device *spi)
 {
 	struct pcap_platform_data *pdata = dev_get_platdata(&spi->dev);
@@ -513,9 +489,9 @@ static int ezx_pcap_probe(struct spi_device *spi)
 
 static struct spi_driver ezxpcap_driver = {
 	.probe	= ezx_pcap_probe,
-	.remove = ezx_pcap_remove,
 	.driver = {
-		.name	= "ezx-pcap",
+		.name			= "ezx-pcap",
+		.suppress_bind_attrs	= true,
 	},
 };
 
@@ -523,16 +499,4 @@ static int __init ezx_pcap_init(void)
 {
 	return spi_register_driver(&ezxpcap_driver);
 }
-
-static void __exit ezx_pcap_exit(void)
-{
-	spi_unregister_driver(&ezxpcap_driver);
-}
-
 subsys_initcall(ezx_pcap_init);
-module_exit(ezx_pcap_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Daniel Ribeiro / Harald Welte");
-MODULE_DESCRIPTION("Motorola PCAP2 ASIC Driver");
-MODULE_ALIAS("spi:ezx-pcap");
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/18 mfd: 88pm860x-*: Make it explicitly non-modular

In reply to Paul Gortmaker

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

drivers/mfd/Makefile:88pm860x-objs := 88pm860x-core.o 88pm860x-i2c.o drivers/mfd/Makefile:obj-$(CONFIG_MFD_88PM860X) += 88pm860x.o

drivers/mfd/Kconfig:config MFD_88PM860X
drivers/mfd/Kconfig: bool "Marvell 88PM8606/88PM8607"

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

In the case of 88pm860x-i2c.c, there is nothing modular whatsoever, so we simply remove module.h itself.

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 Haojian Zhuang <[email protected]>
---
 drivers/mfd/88pm860x-core.c | 40 ++--------------------------------------
 drivers/mfd/88pm860x-i2c.c  |  1 -
 2 files changed, 2 insertions(+), 39 deletions(-)
drivers/mfd/88pm860x-core.c +2 -38
index c9bae71f643a..741012a7a6e1 100644
@@ -8,7 +8,7 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
 #include <linux/irq.h>
@@ -643,12 +643,6 @@ static int device_irq_init(struct pm860x_chip *chip,
 	return ret;
 }
 
-static void device_irq_exit(struct pm860x_chip *chip)
-{
-	if (chip->core_irq)
-		free_irq(chip->core_irq, chip);
-}
-
 int pm8606_osc_enable(struct pm860x_chip *chip, unsigned short client)
 {
 	int ret = -EIO;
@@ -1079,12 +1073,6 @@ static int pm860x_device_init(struct pm860x_chip *chip,
 	return 0;
 }
 
-static void pm860x_device_exit(struct pm860x_chip *chip)
-{
-	device_irq_exit(chip);
-	mfd_remove_devices(chip->dev);
-}
-
 static int verify_addr(struct i2c_client *i2c)
 {
 	unsigned short addr_8607[] = {0x30, 0x34};
@@ -1201,18 +1189,6 @@ static int pm860x_probe(struct i2c_client *client)
 	return 0;
 }
 
-static int pm860x_remove(struct i2c_client *client)
-{
-	struct pm860x_chip *chip = i2c_get_clientdata(client);
-
-	pm860x_device_exit(chip);
-	if (chip->companion) {
-		regmap_exit(chip->regmap_companion);
-		i2c_unregister_device(chip->companion);
-	}
-	return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int pm860x_suspend(struct device *dev)
 {
@@ -1241,22 +1217,20 @@ static const struct i2c_device_id pm860x_id_table[] = {
 	{ "88PM860x", 0 },
 	{}
 };
-MODULE_DEVICE_TABLE(i2c, pm860x_id_table);
 
 static const struct of_device_id pm860x_dt_ids[] = {
 	{ .compatible = "marvell,88pm860x", },
 	{},
 };
-MODULE_DEVICE_TABLE(of, pm860x_dt_ids);
 
 static struct i2c_driver pm860x_driver = {
 	.driver	= {
 		.name	= "88PM860x",
 		.pm     = &pm860x_pm_ops,
 		.of_match_table	= pm860x_dt_ids,
+		.suppress_bind_attrs = true,
 	},
 	.probe_new	= pm860x_probe,
-	.remove		= pm860x_remove,
 	.id_table	= pm860x_id_table,
 };
 
@@ -1270,13 +1244,3 @@ static int __init pm860x_i2c_init(void)
 	return ret;
 }
 subsys_initcall(pm860x_i2c_init);
-
-static void __exit pm860x_i2c_exit(void)
-{
-	i2c_del_driver(&pm860x_driver);
-}
-module_exit(pm860x_i2c_exit);
-
-MODULE_DESCRIPTION("PMIC Driver for Marvell 88PM860x");
-MODULE_AUTHOR("Haojian Zhuang <[email protected]>");
-MODULE_LICENSE("GPL");
drivers/mfd/88pm860x-i2c.c +0 -1
index a000aed35755..986c8c774871 100644
@@ -7,7 +7,6 @@
  * Author: Haojian Zhuang <[email protected]>
  */
 #include <linux/kernel.h>
-#include <linux/module.h>
 #include <linux/i2c.h>
 #include <linux/regmap.h>
 #include <linux/mfd/88pm860x.h>
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/18 mfd: tc3589: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TC3589X
drivers/mfd/Kconfig: bool "Toshiba TC35892 and variants"

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

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 Rabin Vincent <[email protected]>
---
 drivers/mfd/tc3589x.c | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)
drivers/mfd/tc3589x.c +2 -24
index 67c9995bb1aa..ccbdec1a2202 100644
@@ -6,7 +6,7 @@
  * Author: Rabin Vincent <[email protected]> for ST-Ericsson
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
@@ -323,8 +323,6 @@ static const struct of_device_id tc3589x_match[] = {
 	{ }
 };
 
-MODULE_DEVICE_TABLE(of, tc3589x_match);
-
 static struct tc3589x_platform_data *
 tc3589x_of_probe(struct device *dev, enum tc3589x_version *version)
 {
@@ -429,15 +427,6 @@ static int tc3589x_probe(struct i2c_client *i2c,
 	return 0;
 }
 
-static int tc3589x_remove(struct i2c_client *client)
-{
-	struct tc3589x *tc3589x = i2c_get_clientdata(client);
-
-	mfd_remove_devices(tc3589x->dev);
-
-	return 0;
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int tc3589x_suspend(struct device *dev)
 {
@@ -480,16 +469,15 @@ static const struct i2c_device_id tc3589x_id[] = {
 	{ "tc3589x", TC3589X_UNKNOWN },
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, tc3589x_id);
 
 static struct i2c_driver tc3589x_driver = {
 	.driver = {
 		.name	= "tc3589x",
 		.pm	= &tc3589x_dev_pm_ops,
 		.of_match_table = of_match_ptr(tc3589x_match),
+		.suppress_bind_attrs = true,
 	},
 	.probe		= tc3589x_probe,
-	.remove		= tc3589x_remove,
 	.id_table	= tc3589x_id,
 };
 
@@ -498,13 +486,3 @@ static int __init tc3589x_init(void)
 	return i2c_add_driver(&tc3589x_driver);
 }
 subsys_initcall(tc3589x_init);
-
-static void __exit tc3589x_exit(void)
-{
-	i2c_del_driver(&tc3589x_driver);
-}
-module_exit(tc3589x_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("TC3589x MFD core driver");
-MODULE_AUTHOR("Hanumath Prasad, Rabin Vincent");
Signature · 1 line
2.7.4
#6 lore raw

PATCH 6/18 mfd: tc6387xb: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TC6387XB
drivers/mfd/Kconfig: bool "Toshiba TC6387XB"

...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_platform_driver() uses the same init level priority as builtin_platform_driver() 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.

---
 drivers/mfd/tc6387xb.c | 30 ++++--------------------------
 1 file changed, 4 insertions(+), 26 deletions(-)
drivers/mfd/tc6387xb.c +4 -26
index c66a701ab21c..aa2eada4bf30 100644
@@ -6,7 +6,7 @@
  * This file contains TC6387XB base support.
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/err.h>
@@ -199,35 +199,13 @@ static int tc6387xb_probe(struct platform_device *dev)
 	return ret;
 }
 
-static int tc6387xb_remove(struct platform_device *dev)
-{
-	struct tc6387xb *tc6387xb = platform_get_drvdata(dev);
-
-	mfd_remove_devices(&dev->dev);
-	iounmap(tc6387xb->scr);
-	release_resource(&tc6387xb->rscr);
-	clk_disable_unprepare(tc6387xb->clk32k);
-	clk_put(tc6387xb->clk32k);
-	kfree(tc6387xb);
-
-	return 0;
-}
-
-
 static struct platform_driver tc6387xb_platform_driver = {
 	.driver = {
-		.name		= "tc6387xb",
+		.name			= "tc6387xb",
+		.suppress_bind_attrs	= true,
 	},
 	.probe		= tc6387xb_probe,
-	.remove		= tc6387xb_remove,
 	.suspend        = tc6387xb_suspend,
 	.resume         = tc6387xb_resume,
 };
-
-module_platform_driver(tc6387xb_platform_driver);
-
-MODULE_DESCRIPTION("Toshiba TC6387XB core driver");
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Ian Molton");
-MODULE_ALIAS("platform:tc6387xb");
-
+builtin_platform_driver(tc6387xb_platform_driver);
Signature · 1 line
2.7.4
#7 lore raw

PATCH 7/18 mfd: tc6393xb: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TC6393XB
drivers/mfd/Kconfig: bool "Toshiba TC6393XB"

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

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

---
 drivers/mfd/tc6393xb.c | 43 ++-----------------------------------------
 1 file changed, 2 insertions(+), 41 deletions(-)
drivers/mfd/tc6393xb.c +2 -41
index 05d5059ca203..55f6ffb35e7f 100644
@@ -12,7 +12,7 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/platform_device.h>
@@ -730,32 +730,6 @@ static int tc6393xb_probe(struct platform_device *dev)
 	return ret;
 }
 
-static int tc6393xb_remove(struct platform_device *dev)
-{
-	struct tc6393xb_platform_data *tcpd = dev_get_platdata(&dev->dev);
-	struct tc6393xb *tc6393xb = platform_get_drvdata(dev);
-	int ret;
-
-	mfd_remove_devices(&dev->dev);
-
-	if (tcpd->teardown)
-		tcpd->teardown(dev);
-
-	tc6393xb_detach_irq(dev);
-
-	if (tc6393xb->gpio.base != -1)
-		gpiochip_remove(&tc6393xb->gpio);
-
-	ret = tcpd->disable(dev);
-	clk_disable_unprepare(tc6393xb->clk);
-	iounmap(tc6393xb->scr);
-	release_resource(&tc6393xb->rscr);
-	clk_put(tc6393xb->clk);
-	kfree(tc6393xb);
-
-	return ret;
-}
-
 #ifdef CONFIG_PM
 static int tc6393xb_suspend(struct platform_device *dev, pm_message_t state)
 {
@@ -826,12 +800,12 @@ static int tc6393xb_resume(struct platform_device *dev)
 
 static struct platform_driver tc6393xb_driver = {
 	.probe = tc6393xb_probe,
-	.remove = tc6393xb_remove,
 	.suspend = tc6393xb_suspend,
 	.resume = tc6393xb_resume,
 
 	.driver = {
 		.name = "tc6393xb",
+		.suppress_bind_attrs = true,
 	},
 };
 
@@ -839,17 +813,4 @@ static int __init tc6393xb_init(void)
 {
 	return platform_driver_register(&tc6393xb_driver);
 }
-
-static void __exit tc6393xb_exit(void)
-{
-	platform_driver_unregister(&tc6393xb_driver);
-}
-
 subsys_initcall(tc6393xb_init);
-module_exit(tc6393xb_exit);
-
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Ian Molton, Dmitry Baryshkov and Dirk Opfer");
-MODULE_DESCRIPTION("tc6393xb Toshiba Mobile IO Controller");
-MODULE_ALIAS("platform:tc6393xb");
-
Signature · 1 line
2.7.4
#8 lore raw

PATCH 8/18 mfd: twl4030-audio: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TWL4030_AUDIO
drivers/mfd/Kconfig: bool "TI TWL4030 Audio"

...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_platform_driver() uses the same init level priority as builtin_platform_driver() 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.

---
 drivers/mfd/twl4030-audio.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)
drivers/mfd/twl4030-audio.c +3 -18
index 4536d829b43e..7612997e3b86 100644
@@ -8,7 +8,7 @@
  * Copyright:   (C) 2009 Nokia Corporation
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/kernel.h>
@@ -258,32 +258,17 @@ static int twl4030_audio_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int twl4030_audio_remove(struct platform_device *pdev)
-{
-	mfd_remove_devices(&pdev->dev);
-	twl4030_audio_dev = NULL;
-
-	return 0;
-}
-
 static const struct of_device_id twl4030_audio_of_match[] = {
 	{.compatible = "ti,twl4030-audio", },
 	{ },
 };
-MODULE_DEVICE_TABLE(of, twl4030_audio_of_match);
 
 static struct platform_driver twl4030_audio_driver = {
 	.driver		= {
 		.name	= "twl4030-audio",
 		.of_match_table = twl4030_audio_of_match,
+		.suppress_bind_attrs = true,
 	},
 	.probe		= twl4030_audio_probe,
-	.remove		= twl4030_audio_remove,
 };
-
-module_platform_driver(twl4030_audio_driver);
-
-MODULE_AUTHOR("Peter Ujfalusi <[email protected]>");
-MODULE_DESCRIPTION("TWL4030 audio block MFD driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:twl4030-audio");
+builtin_platform_driver(twl4030_audio_driver);
Signature · 1 line
2.7.4
Acked-by on v1 8/18
#9 lore raw

Re: [PATCH 08/18] mfd: twl4030-audio: Make it explicitly non-modular

Quoted 14 lines · Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TWL4030_AUDIO
drivers/mfd/Kconfig: bool "TI TWL4030 Audio"

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

Quoted 8 lines

Since module_platform_driver() uses the same init level priority as builtin_platform_driver() 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 49 lines
---
 drivers/mfd/twl4030-audio.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)
drivers/mfd/twl4030-audio.c +2 -10
index 4536d829b43e..7612997e3b86 100644
@@ -8,7 +8,7 @@
  * Copyright:   (C) 2009 Nokia Corporation
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/kernel.h>
@@ -258,32 +258,17 @@ static int twl4030_audio_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int twl4030_audio_remove(struct platform_device *pdev)
-{
-	mfd_remove_devices(&pdev->dev);
-	twl4030_audio_dev = NULL;
-
-	return 0;
-}
-
 static const struct of_device_id twl4030_audio_of_match[] = {
 	{.compatible = "ti,twl4030-audio", },
 	{ },
 };
-MODULE_DEVICE_TABLE(of, twl4030_audio_of_match);
 
 static struct platform_driver twl4030_audio_driver = {
 	.driver		= {
 		.name	= "twl4030-audio",
 		.of_match_table = twl4030_audio_of_match,
+		.suppress_bind_attrs = true,
 	},
 	.probe		= twl4030_audio_probe,

drivers/mfd/twl4030-audio.c static int twl4030_audio_probe(struct platform_device *pdev) · line 274

Quoted 10 lines
drivers/mfd/twl4030-audio.c +1 -8
-	.remove		= twl4030_audio_remove,
 };
-
-module_platform_driver(twl4030_audio_driver);
-
-MODULE_AUTHOR("Peter Ujfalusi <[email protected]>");
-MODULE_DESCRIPTION("TWL4030 audio block MFD driver");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:twl4030-audio");
+builtin_platform_driver(twl4030_audio_driver);

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

#10 lore raw

PATCH 9/18 mfd: twl4030-power: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config TWL4030_POWER
drivers/mfd/Kconfig: bool "TI TWL4030 power resources"

...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. The remove function here was clearly a no-op anyway, so no unbind functionality could possibly be impacted.

Since module_platform_driver() uses the same init level priority as builtin_platform_driver() 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.

---
 drivers/mfd/twl4030-power.c | 19 +++----------------
 1 file changed, 3 insertions(+), 16 deletions(-)
drivers/mfd/twl4030-power.c +3 -16
index 6b36932263ba..5655218b2552 100644
@@ -23,7 +23,7 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/pm.h>
 #include <linux/mfd/twl.h>
 #include <linux/platform_device.h>
@@ -876,7 +876,6 @@ static const struct of_device_id twl4030_power_of_match[] = {
 	},
 	{ },
 };
-MODULE_DEVICE_TABLE(of, twl4030_power_of_match);
 #endif	/* CONFIG_OF */
 
 static int twl4030_power_probe(struct platform_device *pdev)
@@ -953,24 +952,12 @@ static int twl4030_power_probe(struct platform_device *pdev)
 	return err;
 }
 
-static int twl4030_power_remove(struct platform_device *pdev)
-{
-	return 0;
-}
-
 static struct platform_driver twl4030_power_driver = {
 	.driver = {
 		.name	= "twl4030_power",
 		.of_match_table = of_match_ptr(twl4030_power_of_match),
+		.suppress_bind_attrs = true,
 	},
 	.probe		= twl4030_power_probe,
-	.remove		= twl4030_power_remove,
 };
-
-module_platform_driver(twl4030_power_driver);
-
-MODULE_AUTHOR("Nokia Corporation");
-MODULE_AUTHOR("Texas Instruments, Inc.");
-MODULE_DESCRIPTION("Power management for TWL4030");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:twl4030_power");
+builtin_platform_driver(twl4030_power_driver);
Signature · 1 line
2.7.4
#11 lore raw

PATCH 10/18 mfd: twl6040: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig/Makefile controlling compilation of this code is:

drivers/mfd/Kconfig:config TWL6040_CORE
drivers/mfd/Kconfig: bool "TI TWL6040 audio codec"

drivers/mfd/Makefile: obj-$(CONFIG_TWL6040_CORE) += twl6040.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_i2c_driver() uses the same init level priority as builtin_i2c_driver() 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 Tony Lindgren <[email protected]>
Cc Lee Jones <[email protected]>
Cc Misael Lopez Cruz <[email protected]>
Cc Jorge Eduardo Candelaria <[email protected]>
---
 drivers/mfd/twl6040.c | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)
drivers/mfd/twl6040.c +3 -26
index b9c6d94b4002..531eefb2fab5 100644
@@ -9,7 +9,7 @@
  * Copyright:	(C) 2011 Texas Instruments, Inc.
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/kernel.h>
@@ -808,41 +808,18 @@ static int twl6040_probe(struct i2c_client *client,
 	return ret;
 }
 
-static int twl6040_remove(struct i2c_client *client)
-{
-	struct twl6040 *twl6040 = i2c_get_clientdata(client);
-
-	if (twl6040->power_count)
-		twl6040_power(twl6040, 0);
-
-	regmap_del_irq_chip(twl6040->irq, twl6040->irq_data);
-
-	mfd_remove_devices(&client->dev);
-
-	regulator_bulk_disable(TWL6040_NUM_SUPPLIES, twl6040->supplies);
-
-	return 0;
-}
-
 static const struct i2c_device_id twl6040_i2c_id[] = {
 	{ "twl6040", 0, },
 	{ "twl6041", 0, },
 	{ },
 };
-MODULE_DEVICE_TABLE(i2c, twl6040_i2c_id);
 
 static struct i2c_driver twl6040_driver = {
 	.driver = {
 		.name = "twl6040",
+		.suppress_bind_attrs = true,
 	},
 	.probe		= twl6040_probe,
-	.remove		= twl6040_remove,
 	.id_table	= twl6040_i2c_id,
 };
-
-module_i2c_driver(twl6040_driver);
-
-MODULE_DESCRIPTION("TWL6040 MFD");
-MODULE_AUTHOR("Misael Lopez Cruz <[email protected]>");
-MODULE_AUTHOR("Jorge Eduardo Candelaria <[email protected]>");
-MODULE_LICENSE("GPL");
+builtin_i2c_driver(twl6040_driver);
Signature · 1 line
2.7.4
#12 lore raw

PATCH 11/18 mfd: t7l66xb: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_T7L66XB
drivers/mfd/Kconfig: bool "Toshiba T7L66XB"

...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_platform_driver() uses the same init level priority as builtin_platform_driver() 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.

---
 drivers/mfd/t7l66xb.c | 37 ++++---------------------------------
 1 file changed, 4 insertions(+), 33 deletions(-)
drivers/mfd/t7l66xb.c +4 -33
index 70da0c4ae457..636b9c8dc96d 100644
@@ -20,7 +20,7 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/slab.h>
@@ -403,42 +403,13 @@ static int t7l66xb_probe(struct platform_device *dev)
 	return ret;
 }
 
-static int t7l66xb_remove(struct platform_device *dev)
-{
-	struct t7l66xb_platform_data *pdata = dev_get_platdata(&dev->dev);
-	struct t7l66xb *t7l66xb = platform_get_drvdata(dev);
-	int ret;
-
-	ret = pdata->disable(dev);
-	clk_disable_unprepare(t7l66xb->clk48m);
-	clk_put(t7l66xb->clk48m);
-	clk_disable_unprepare(t7l66xb->clk32k);
-	clk_put(t7l66xb->clk32k);
-	t7l66xb_detach_irq(dev);
-	iounmap(t7l66xb->scr);
-	release_resource(&t7l66xb->rscr);
-	mfd_remove_devices(&dev->dev);
-	kfree(t7l66xb);
-
-	return ret;
-
-}
-
 static struct platform_driver t7l66xb_platform_driver = {
 	.driver = {
-		.name	= "t7l66xb",
+		.name			= "t7l66xb",
+		.suppress_bind_attrs	= true,
 	},
 	.suspend	= t7l66xb_suspend,
 	.resume		= t7l66xb_resume,
 	.probe		= t7l66xb_probe,
-	.remove		= t7l66xb_remove,
 };
-
-/*--------------------------------------------------------------------------*/
-
-module_platform_driver(t7l66xb_platform_driver);
-
-MODULE_DESCRIPTION("Toshiba T7L66XB core driver");
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Ian Molton");
-MODULE_ALIAS("platform:t7l66xb");
+builtin_platform_driver(t7l66xb_platform_driver);
Signature · 1 line
2.7.4
#13 lore raw

PATCH 12/18 mfd: lp8788: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_LP8788
drivers/mfd/Kconfig: bool "TI LP8788 Power Management Unit Driver"

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

---
 drivers/mfd/lp8788.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)
drivers/mfd/lp8788.c +2 -22
index 768d556b3fe9..b218855e4162 100644
@@ -11,7 +11,7 @@
 #include <linux/i2c.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/lp8788.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 
 #define MAX_LP8788_REGISTERS		0xA2
@@ -199,27 +199,17 @@ static int lp8788_probe(struct i2c_client *cl, const struct i2c_device_id *id)
 			       ARRAY_SIZE(lp8788_devs), NULL, 0, NULL);
 }
 
-static int lp8788_remove(struct i2c_client *cl)
-{
-	struct lp8788 *lp = i2c_get_clientdata(cl);
-
-	mfd_remove_devices(lp->dev);
-	lp8788_irq_exit(lp);
-	return 0;
-}
-
 static const struct i2c_device_id lp8788_ids[] = {
 	{"lp8788", 0},
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, lp8788_ids);
 
 static struct i2c_driver lp8788_driver = {
 	.driver = {
 		.name = "lp8788",
+		.suppress_bind_attrs = true,
 	},
 	.probe = lp8788_probe,
-	.remove = lp8788_remove,
 	.id_table = lp8788_ids,
 };
 
@@ -228,13 +218,3 @@ static int __init lp8788_init(void)
 	return i2c_add_driver(&lp8788_driver);
 }
 subsys_initcall(lp8788_init);
-
-static void __exit lp8788_exit(void)
-{
-	i2c_del_driver(&lp8788_driver);
-}
-module_exit(lp8788_exit);
-
-MODULE_DESCRIPTION("TI LP8788 MFD Driver");
-MODULE_AUTHOR("Milo Kim");
-MODULE_LICENSE("GPL");
Signature · 1 line
2.7.4
#14 lore raw

PATCH 13/18 mfd: menelaus: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MENELAUS
drivers/mfd/Kconfig: bool "TI TWL92330/Menelaus PM 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.

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_i2c_driver() uses the same init level priority as builtin_i2c_driver() 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.

---
 drivers/mfd/menelaus.c | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)
drivers/mfd/menelaus.c +4 -20
index b64d3315a5e1..65a268d11aaa 100644
@@ -18,7 +18,7 @@
  * Copyright (C) 2005, 2006 Nokia Corporation
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/sched.h>
@@ -1222,33 +1222,17 @@ static int menelaus_probe(struct i2c_client *client,
 	return err;
 }
 
-static int menelaus_remove(struct i2c_client *client)
-{
-	struct menelaus_chip	*menelaus = i2c_get_clientdata(client);
-
-	free_irq(client->irq, menelaus);
-	flush_work(&menelaus->work);
-	the_menelaus = NULL;
-	return 0;
-}
-
 static const struct i2c_device_id menelaus_id[] = {
 	{ "menelaus", 0 },
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, menelaus_id);
 
 static struct i2c_driver menelaus_i2c_driver = {
 	.driver = {
-		.name		= DRIVER_NAME,
+		.name			= DRIVER_NAME,
+		.suppress_bind_attrs	= true,
 	},
 	.probe		= menelaus_probe,
-	.remove		= menelaus_remove,
 	.id_table	= menelaus_id,
 };
-
-module_i2c_driver(menelaus_i2c_driver);
-
-MODULE_AUTHOR("Texas Instruments, Inc. (and others)");
-MODULE_DESCRIPTION("I2C interface for Menelaus.");
-MODULE_LICENSE("GPL");
+builtin_i2c_driver(menelaus_i2c_driver);
Signature · 1 line
2.7.4
#15 lore raw

PATCH 14/18 mfd: tps6586x: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_TPS6586X
drivers/mfd/Kconfig: bool "TI TPS6586x Power Management chips"

...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 Lee Jones <[email protected]>
Cc Mike Rapoport <[email protected]>
---
 drivers/mfd/tps6586x.c | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)
drivers/mfd/tps6586x.c +2 -24
index c8aadd39324e..d7db10d34193 100644
@@ -16,7 +16,7 @@
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
 #include <linux/err.h>
@@ -578,17 +578,6 @@ static int tps6586x_i2c_probe(struct i2c_client *client,
 	return ret;
 }
 
-static int tps6586x_i2c_remove(struct i2c_client *client)
-{
-	struct tps6586x *tps6586x = i2c_get_clientdata(client);
-
-	tps6586x_remove_subdevs(tps6586x);
-	mfd_remove_devices(tps6586x->dev);
-	if (client->irq)
-		free_irq(client->irq, tps6586x);
-	return 0;
-}
-
 static int __maybe_unused tps6586x_i2c_suspend(struct device *dev)
 {
 	struct tps6586x *tps6586x = dev_get_drvdata(dev);
@@ -616,16 +605,15 @@ static const struct i2c_device_id tps6586x_id_table[] = {
 	{ "tps6586x", 0 },
 	{ },
 };
-MODULE_DEVICE_TABLE(i2c, tps6586x_id_table);
 
 static struct i2c_driver tps6586x_driver = {
 	.driver	= {
 		.name	= "tps6586x",
 		.of_match_table = of_match_ptr(tps6586x_of_match),
 		.pm	= &tps6586x_pm_ops,
+		.suppress_bind_attrs = true,
 	},
 	.probe		= tps6586x_i2c_probe,
-	.remove		= tps6586x_i2c_remove,
 	.id_table	= tps6586x_id_table,
 };
 
@@ -634,13 +622,3 @@ static int __init tps6586x_init(void)
 	return i2c_add_driver(&tps6586x_driver);
 }
 subsys_initcall(tps6586x_init);
-
-static void __exit tps6586x_exit(void)
-{
-	i2c_del_driver(&tps6586x_driver);
-}
-module_exit(tps6586x_exit);
-
-MODULE_DESCRIPTION("TPS6586X core driver");
-MODULE_AUTHOR("Mike Rapoport <[email protected]>");
-MODULE_LICENSE("GPL");
Signature · 1 line
2.7.4
#16 lore raw

PATCH 15/18 mfd: omap-usb-tll: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_OMAP_USB_HOST
drivers/mfd/Kconfig: bool "TI OMAP USBHS core and TLL driver"

...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 Tony Lindgren <[email protected]>
Cc Lee Jones <[email protected]>
Cc Keshava Munegowda <[email protected]>
Cc Roger Quadros <[email protected]>
---
 drivers/mfd/omap-usb-tll.c | 47 ++++------------------------------------------
 1 file changed, 4 insertions(+), 43 deletions(-)
drivers/mfd/omap-usb-tll.c +4 -43
index 265f5e350e1c..77c8d98a6731 100644
@@ -7,7 +7,7 @@
  * Author: Roger Quadros <[email protected]>
  */
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
@@ -269,46 +269,18 @@ static int usbtll_omap_probe(struct platform_device *pdev)
 	return 0;
 }
 
-/**
- * usbtll_omap_remove - shutdown processing for UHH & TLL HCDs
- * @pdev: USB Host Controller being removed
- *
- * Reverses the effect of usbtll_omap_probe().
- */
-static int usbtll_omap_remove(struct platform_device *pdev)
-{
-	struct usbtll_omap *tll = platform_get_drvdata(pdev);
-	int i;
-
-	spin_lock(&tll_lock);
-	tll_dev = NULL;
-	spin_unlock(&tll_lock);
-
-	for (i = 0; i < tll->nch; i++) {
-		if (!IS_ERR(tll->ch_clk[i])) {
-			clk_unprepare(tll->ch_clk[i]);
-			clk_put(tll->ch_clk[i]);
-		}
-	}
-
-	pm_runtime_disable(&pdev->dev);
-	return 0;
-}
-
 static const struct of_device_id usbtll_omap_dt_ids[] = {
 	{ .compatible = "ti,usbhs-tll" },
 	{ }
 };
 
-MODULE_DEVICE_TABLE(of, usbtll_omap_dt_ids);
-
 static struct platform_driver usbtll_omap_driver = {
 	.driver = {
-		.name		= (char *)usbtll_driver_name,
-		.of_match_table = usbtll_omap_dt_ids,
+		.name			= (char *)usbtll_driver_name,
+		.of_match_table		= usbtll_omap_dt_ids,
+		.suppress_bind_attrs	= true,
 	},
 	.probe		= usbtll_omap_probe,
-	.remove		= usbtll_omap_remove,
 };
 
 int omap_tll_init(struct usbhs_omap_platform_data *pdata)
@@ -446,11 +418,6 @@ int omap_tll_disable(struct usbhs_omap_platform_data *pdata)
 }
 EXPORT_SYMBOL_GPL(omap_tll_disable);
 
-MODULE_AUTHOR("Keshava Munegowda <[email protected]>");
-MODULE_AUTHOR("Roger Quadros <[email protected]>");
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("usb tll driver for TI OMAP EHCI and OHCI controllers");
-
 static int __init omap_usbtll_drvinit(void)
 {
 	return platform_driver_register(&usbtll_omap_driver);
@@ -462,9 +429,3 @@ static int __init omap_usbtll_drvinit(void)
  * the usbhs core driver probe function is called.
  */
 fs_initcall(omap_usbtll_drvinit);
-
-static void __exit omap_usbtll_drvexit(void)
-{
-	platform_driver_unregister(&usbtll_omap_driver);
-}
-module_exit(omap_usbtll_drvexit);
Signature · 1 line
2.7.4
#17 lore raw

PATCH 16/18 mfd: omap-usb-host: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_OMAP_USB_HOST
drivers/mfd/Kconfig: bool "TI OMAP USBHS core and TLL driver"

...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 Tony Lindgren <[email protected]>
Cc Lee Jones <[email protected]>
Cc Keshava Munegowda <[email protected]>
Cc Roger Quadros <[email protected]>
---
 drivers/mfd/omap-usb-host.c | 47 +++++----------------------------------------
 1 file changed, 5 insertions(+), 42 deletions(-)
drivers/mfd/omap-usb-host.c +5 -42
index 4798d9f3f9d5..118756d7be19 100644
@@ -7,7 +7,7 @@
  * Author: Roger Quadros <[email protected]>
  */
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/types.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
@@ -803,28 +803,6 @@ static int usbhs_omap_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static int usbhs_omap_remove_child(struct device *dev, void *data)
-{
-	dev_info(dev, "unregistering\n");
-	platform_device_unregister(to_platform_device(dev));
-	return 0;
-}
-
-/**
- * usbhs_omap_remove - shutdown processing for UHH & TLL HCDs
- * @pdev: USB Host Controller being removed
- *
- * Reverses the effect of usbhs_omap_probe().
- */
-static int usbhs_omap_remove(struct platform_device *pdev)
-{
-	pm_runtime_disable(&pdev->dev);
-
-	/* remove children */
-	device_for_each_child(&pdev->dev, NULL, usbhs_omap_remove_child);
-	return 0;
-}
-
 static const struct dev_pm_ops usbhsomap_dev_pm_ops = {
 	.runtime_suspend	= usbhs_runtime_suspend,
 	.runtime_resume		= usbhs_runtime_resume,
@@ -835,25 +813,16 @@ static const struct of_device_id usbhs_omap_dt_ids[] = {
 	{ }
 };
 
-MODULE_DEVICE_TABLE(of, usbhs_omap_dt_ids);
-
-
 static struct platform_driver usbhs_omap_driver = {
 	.driver = {
-		.name		= (char *)usbhs_driver_name,
-		.pm		= &usbhsomap_dev_pm_ops,
-		.of_match_table = usbhs_omap_dt_ids,
+		.name			= (char *)usbhs_driver_name,
+		.pm			= &usbhsomap_dev_pm_ops,
+		.of_match_table		= usbhs_omap_dt_ids,
+		.suppress_bind_attr	= true,
 	},
 	.probe		= usbhs_omap_probe,
-	.remove		= usbhs_omap_remove,
 };
 
-MODULE_AUTHOR("Keshava Munegowda <[email protected]>");
-MODULE_AUTHOR("Roger Quadros <[email protected]>");
-MODULE_ALIAS("platform:" USBHS_DRIVER_NAME);
-MODULE_LICENSE("GPL v2");
-MODULE_DESCRIPTION("usb host common core driver for omap EHCI and OHCI");
-
 static int omap_usbhs_drvinit(void)
 {
 	return platform_driver_register(&usbhs_omap_driver);
@@ -867,9 +836,3 @@ static int omap_usbhs_drvinit(void)
  * usb tll driver
  */
 fs_initcall_sync(omap_usbhs_drvinit);
-
-static void omap_usbhs_drvexit(void)
-{
-	platform_driver_unregister(&usbhs_omap_driver);
-}
-module_exit(omap_usbhs_drvexit);
Signature · 1 line
2.7.4
#18 lore raw

PATCH 17/18 mfd: palmas: Make it explicitly non-modular

In reply to Paul Gortmaker

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_PALMAS
drivers/mfd/Kconfig: bool "TI Palmas series chips"

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

We delete the include of module.h as well as an unused instance of moduleparam.h include as well.

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.

---
 drivers/mfd/palmas.c | 36 +-----------------------------------
 1 file changed, 1 insertion(+), 35 deletions(-)
drivers/mfd/palmas.c +1 -35
index f5b3fa973b13..0e96c5cd02c6 100644
@@ -7,8 +7,6 @@
  * Author: Graeme Gregory <[email protected]>
  */
 
-#include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
@@ -500,7 +498,6 @@ static const struct of_device_id of_palmas_match_tbl[] = {
 	},
 	{ },
 };
-MODULE_DEVICE_TABLE(of, of_palmas_match_tbl);
 
 static int palmas_i2c_probe(struct i2c_client *i2c,
 			    const struct i2c_device_id *id)
@@ -700,26 +697,6 @@ static int palmas_i2c_probe(struct i2c_client *i2c,
 	return ret;
 }
 
-static int palmas_i2c_remove(struct i2c_client *i2c)
-{
-	struct palmas *palmas = i2c_get_clientdata(i2c);
-	int i;
-
-	regmap_del_irq_chip(palmas->irq, palmas->irq_data);
-
-	for (i = 1; i < PALMAS_NUM_CLIENTS; i++) {
-		if (palmas->i2c_clients[i])
-			i2c_unregister_device(palmas->i2c_clients[i]);
-	}
-
-	if (palmas == palmas_dev) {
-		pm_power_off = NULL;
-		palmas_dev = NULL;
-	}
-
-	return 0;
-}
-
 static const struct i2c_device_id palmas_i2c_id[] = {
 	{ "palmas", },
 	{ "twl6035", },
@@ -727,15 +704,14 @@ static const struct i2c_device_id palmas_i2c_id[] = {
 	{ "tps65913", },
 	{ /* end */ }
 };
-MODULE_DEVICE_TABLE(i2c, palmas_i2c_id);
 
 static struct i2c_driver palmas_i2c_driver = {
 	.driver = {
 		   .name = "palmas",
 		   .of_match_table = of_palmas_match_tbl,
+		   .suppress_bind_attrs = true,
 	},
 	.probe = palmas_i2c_probe,
-	.remove = palmas_i2c_remove,
 	.id_table = palmas_i2c_id,
 };
 
@@ -745,13 +721,3 @@ static int __init palmas_i2c_init(void)
 }
 /* init early so consumer devices can complete system boot */
 subsys_initcall(palmas_i2c_init);
-
-static void __exit palmas_i2c_exit(void)
-{
-	i2c_del_driver(&palmas_i2c_driver);
-}
-module_exit(palmas_i2c_exit);
-
-MODULE_AUTHOR("Graeme Gregory <[email protected]>");
-MODULE_DESCRIPTION("Palmas chip family multi-function driver");
-MODULE_LICENSE("GPL");
Signature · 1 line
2.7.4
#19 lore raw

PATCH 18/18 mfd: intel_soc_pmic_core: Make it explicitly non-modular

In reply to Paul Gortmaker

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

drivers/mfd/Makefile:intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o
drivers/mfd/Makefile:obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
drivers/mfd/Kconfig:config INTEL_SOC_PMIC
drivers/mfd/Kconfig: bool "Support for Intel Atom SoC PMIC"

...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_i2c_driver() uses the same init level priority as builtin_i2c_driver() 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 Yang, Bin <[email protected]>
Cc Zhu, Lejun <[email protected]>
---
 drivers/mfd/intel_soc_pmic_core.c | 31 +++----------------------------
 1 file changed, 3 insertions(+), 28 deletions(-)
drivers/mfd/intel_soc_pmic_core.c +3 -28
index c9f35378d391..33d1a658e25f 100644
@@ -13,7 +13,7 @@
 #include <linux/gpio/machine.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/intel_soc_pmic.h>
 #include <linux/pwm.h>
@@ -115,23 +115,6 @@ static int intel_soc_pmic_i2c_probe(struct i2c_client *i2c,
 	return ret;
 }
 
-static int intel_soc_pmic_i2c_remove(struct i2c_client *i2c)
-{
-	struct intel_soc_pmic *pmic = dev_get_drvdata(&i2c->dev);
-
-	regmap_del_irq_chip(pmic->irq, pmic->irq_chip_data);
-
-	/* Remove lookup table for Panel Control from the GPIO Chip */
-	gpiod_remove_lookup_table(&panel_gpio_table);
-
-	/* remove crc-pwm lookup table */
-	pwm_remove_table(crc_pwm_lookup, ARRAY_SIZE(crc_pwm_lookup));
-
-	mfd_remove_devices(&i2c->dev);
-
-	return 0;
-}
-
 static void intel_soc_pmic_shutdown(struct i2c_client *i2c)
 {
 	struct intel_soc_pmic *pmic = dev_get_drvdata(&i2c->dev);
@@ -167,14 +150,12 @@ static SIMPLE_DEV_PM_OPS(intel_soc_pmic_pm_ops, intel_soc_pmic_suspend,
 static const struct i2c_device_id intel_soc_pmic_i2c_id[] = {
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, intel_soc_pmic_i2c_id);
 
 #if defined(CONFIG_ACPI)
 static const struct acpi_device_id intel_soc_pmic_acpi_match[] = {
 	{ "INT33FD" },
 	{ },
 };
-MODULE_DEVICE_TABLE(acpi, intel_soc_pmic_acpi_match);
 #endif
 
 static struct i2c_driver intel_soc_pmic_i2c_driver = {
@@ -182,16 +163,10 @@ static struct i2c_driver intel_soc_pmic_i2c_driver = {
 		.name = "intel_soc_pmic_i2c",
 		.pm = &intel_soc_pmic_pm_ops,
 		.acpi_match_table = ACPI_PTR(intel_soc_pmic_acpi_match),
+		.suppress_bind_attrs = true,
 	},
 	.probe = intel_soc_pmic_i2c_probe,
-	.remove = intel_soc_pmic_i2c_remove,
 	.id_table = intel_soc_pmic_i2c_id,
 	.shutdown = intel_soc_pmic_shutdown,
 };
-
-module_i2c_driver(intel_soc_pmic_i2c_driver);
-
-MODULE_DESCRIPTION("I2C driver for Intel SoC PMIC");
-MODULE_LICENSE("GPL v2");
-MODULE_AUTHOR("Yang, Bin <[email protected]>");
-MODULE_AUTHOR("Zhu, Lejun <[email protected]>");
+builtin_i2c_driver(intel_soc_pmic_i2c_driver);
Signature · 1 line
2.7.4