lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170603130351.13913-3-paul.gortmaker@windriver.com>
Date:   Sat, 3 Jun 2017 09:03:49 -0400
From:   Paul Gortmaker <paul.gortmaker@...driver.com>
To:     <linux-kernel@...r.kernel.org>
CC:     Paul Gortmaker <paul.gortmaker@...driver.com>,
        Support Opensource <support.opensource@...semi.com>,
        Lee Jones <lee.jones@...aro.org>,
        David Dajun Chen <dchen@...semi.com>
Subject: [PATCH 2/4] mfd: da9052-*: Make it explicitly non-modular

The Kconfigis currently controlling compilation of this code are:

mfd/Kconfig:config MFD_DA9052_SPI
mfd/Kconfig:    bool "Dialog Semiconductor DA9052/53 PMIC variants with SPI"

mfd/Kconfig:config MFD_DA9052_I2C
mfd/Kconfig:    bool "Dialog Semiconductor DA9052/53 PMIC variants with I2C"

drivers/mfd/Kconfig:config PMIC_DA9052
drivers/mfd/Kconfig:    bool

...meaning that this code is never built as a module.

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, da9052_device_exit() becomes orphaned, so it gets
removed as well.

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 replace module.h with init.h where required, i.e. if the the file
did not include that already.

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

Cc: Support Opensource <support.opensource@...semi.com>
Cc: Lee Jones <lee.jones@...aro.org>
Cc: David Dajun Chen <dchen@...semi.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@...driver.com>
---
 drivers/mfd/da9052-core.c         | 11 -----------
 drivers/mfd/da9052-i2c.c          | 22 ++--------------------
 drivers/mfd/da9052-irq.c          |  1 -
 drivers/mfd/da9052-spi.c          | 22 ++--------------------
 include/linux/mfd/da9052/da9052.h |  1 -
 5 files changed, 4 insertions(+), 53 deletions(-)

diff --git a/drivers/mfd/da9052-core.c b/drivers/mfd/da9052-core.c
index a88c2065d8ab..ca878d9ab712 100644
--- a/drivers/mfd/da9052-core.c
+++ b/drivers/mfd/da9052-core.c
@@ -17,7 +17,6 @@
 #include <linux/interrupt.h>
 #include <linux/mfd/core.h>
 #include <linux/slab.h>
-#include <linux/module.h>
 
 #include <linux/mfd/da9052/da9052.h>
 #include <linux/mfd/da9052/pdata.h>
@@ -626,13 +625,3 @@ int da9052_device_init(struct da9052 *da9052, u8 chip_id)
 
 	return ret;
 }
-
-void da9052_device_exit(struct da9052 *da9052)
-{
-	mfd_remove_devices(da9052->dev);
-	da9052_irq_exit(da9052);
-}
-
-MODULE_AUTHOR("David Dajun Chen <dchen@...semi.com>");
-MODULE_DESCRIPTION("DA9052 MFD Core");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9052-i2c.c b/drivers/mfd/da9052-i2c.c
index 578e881067a5..cf881907b4b3 100644
--- a/drivers/mfd/da9052-i2c.c
+++ b/drivers/mfd/da9052-i2c.c
@@ -13,7 +13,7 @@
  */
 
 #include <linux/device.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/mfd/core.h>
 #include <linux/i2c.h>
@@ -177,20 +177,12 @@ static int da9052_i2c_probe(struct i2c_client *client,
 	return da9052_device_init(da9052, id->driver_data);
 }
 
-static int da9052_i2c_remove(struct i2c_client *client)
-{
-	struct da9052 *da9052 = i2c_get_clientdata(client);
-
-	da9052_device_exit(da9052);
-	return 0;
-}
-
 static struct i2c_driver da9052_i2c_driver = {
 	.probe = da9052_i2c_probe,
-	.remove = da9052_i2c_remove,
 	.id_table = da9052_i2c_id,
 	.driver = {
 		.name = "da9052",
+		.suppress_bind_attrs = true,
 #ifdef CONFIG_OF
 		.of_match_table = dialog_dt_ids,
 #endif
@@ -210,13 +202,3 @@ static int __init da9052_i2c_init(void)
 	return 0;
 }
 subsys_initcall(da9052_i2c_init);
-
-static void __exit da9052_i2c_exit(void)
-{
-	i2c_del_driver(&da9052_i2c_driver);
-}
-module_exit(da9052_i2c_exit);
-
-MODULE_AUTHOR("David Dajun Chen <dchen@...semi.com>");
-MODULE_DESCRIPTION("I2C driver for Dialog DA9052 PMIC");
-MODULE_LICENSE("GPL");
diff --git a/drivers/mfd/da9052-irq.c b/drivers/mfd/da9052-irq.c
index cd4ca849ca44..6e0db46f71a9 100644
--- a/drivers/mfd/da9052-irq.c
+++ b/drivers/mfd/da9052-irq.c
@@ -20,7 +20,6 @@
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/slab.h>
-#include <linux/module.h>
 
 #include <linux/mfd/da9052/da9052.h>
 #include <linux/mfd/da9052/reg.h>
diff --git a/drivers/mfd/da9052-spi.c b/drivers/mfd/da9052-spi.c
index b9ea1b27db64..322f31f5c522 100644
--- a/drivers/mfd/da9052-spi.c
+++ b/drivers/mfd/da9052-spi.c
@@ -13,7 +13,7 @@
  */
 
 #include <linux/device.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/input.h>
 #include <linux/mfd/core.h>
 #include <linux/spi/spi.h>
@@ -59,14 +59,6 @@ static int da9052_spi_probe(struct spi_device *spi)
 	return da9052_device_init(da9052, id->driver_data);
 }
 
-static int da9052_spi_remove(struct spi_device *spi)
-{
-	struct da9052 *da9052 = spi_get_drvdata(spi);
-
-	da9052_device_exit(da9052);
-	return 0;
-}
-
 static struct spi_device_id da9052_spi_id[] = {
 	{"da9052", DA9052},
 	{"da9053-aa", DA9053_AA},
@@ -78,10 +70,10 @@ static struct spi_device_id da9052_spi_id[] = {
 
 static struct spi_driver da9052_spi_driver = {
 	.probe = da9052_spi_probe,
-	.remove = da9052_spi_remove,
 	.id_table = da9052_spi_id,
 	.driver = {
 		.name = "da9052",
+		.suppress_bind_attrs = true,
 	},
 };
 
@@ -98,13 +90,3 @@ static int __init da9052_spi_init(void)
 	return 0;
 }
 subsys_initcall(da9052_spi_init);
-
-static void __exit da9052_spi_exit(void)
-{
-	spi_unregister_driver(&da9052_spi_driver);
-}
-module_exit(da9052_spi_exit);
-
-MODULE_AUTHOR("David Dajun Chen <dchen@...semi.com>");
-MODULE_DESCRIPTION("SPI driver for Dialog DA9052 PMIC");
-MODULE_LICENSE("GPL");
diff --git a/include/linux/mfd/da9052/da9052.h b/include/linux/mfd/da9052/da9052.h
index ce9230af09c2..a5857f9fccab 100644
--- a/include/linux/mfd/da9052/da9052.h
+++ b/include/linux/mfd/da9052/da9052.h
@@ -209,7 +209,6 @@ static inline int da9052_reg_update(struct da9052 *da9052, unsigned char reg,
 }
 
 int da9052_device_init(struct da9052 *da9052, u8 chip_id);
-void da9052_device_exit(struct da9052 *da9052);
 
 extern const struct regmap_config da9052_regmap_config;
 
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ