[PATCH 04/18] mfd: 88pm860x-*: Make it explicitly non-modular

From: Paul Gortmaker
Date: Wed Dec 18 2019 - 15:50:20 EST


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 <lee.jones@xxxxxxxxxx>
Cc: Haojian Zhuang <haojian.zhuang@xxxxxxxxxxx>
Signed-off-by: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>
---
drivers/mfd/88pm860x-core.c | 40 ++--------------------------------------
drivers/mfd/88pm860x-i2c.c | 1 -
2 files changed, 2 insertions(+), 39 deletions(-)

diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c
index c9bae71f643a..741012a7a6e1 100644
--- a/drivers/mfd/88pm860x-core.c
+++ b/drivers/mfd/88pm860x-core.c
@@ -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 <haojian.zhuang@xxxxxxxxxxx>");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c
index a000aed35755..986c8c774871 100644
--- a/drivers/mfd/88pm860x-i2c.c
+++ b/drivers/mfd/88pm860x-i2c.c
@@ -7,7 +7,6 @@
* Author: Haojian Zhuang <haojian.zhuang@xxxxxxxxxxx>
*/
#include <linux/kernel.h>
-#include <linux/module.h>
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/mfd/88pm860x.h>
--
2.7.4