linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] mfd: Make max drivers explicitly non-modular
@ 2016-06-03  0:39 Paul Gortmaker
  2016-06-03  0:39 ` [PATCH 1/5] mfd: max8925-i2c: Make it " Paul Gortmaker
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-03  0:39 UTC (permalink / raw)
  To: linux-kernel, Lee Jones, Kyungmin Park, Javier Martinez Canillas
  Cc: Paul Gortmaker, Chanwoo Choi, Haojian Zhuang,
	Krzysztof Kozlowski, MyungJoo Ham, Samuel Ortiz

For anyone new to the underlying goal of this cleanup, 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 other 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 like weeds.

There are quite a few in the mfd space, so rather than send a large
series, I'll try and batch them up into reasonable sized queues.  To that
end, here we fix up all the maxim drivers as the 1st mfd batch.

As always, the option exists for someone with the hardware and the desire
to extend the functionality to make any given driver tristate.  But given
the number of these tree wide and the fact that I can't test that new
extended functionality in all cases, I just make the code consistent with
the existing Kconfig/Makefile settings that restrict them to "bool".

Build tested on linux-next for arm, arm64 and x86-64 to ensure no typos
or similar issues crept in.

Paul.
---

[v2: - drop two patches for drivers getting tristate conversion from JMC.
     - fix up shortlog/subjects to match existing mfd style/convention.
     - rebase to current linux-next and redo build testing. ]

[v1: https://lkml.kernel.org/r/1459718659-28316-1-git-send-email-paul.gortmaker@windriver.com ]

Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Javier Martinez Canillas <javier@osg.samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>


Paul Gortmaker (5):
  mfd: max8925-i2c: Make it explicitly non-modular
  mfd: max8997: Make it explicitly non-modular
  mfd: max8998: Make it explicitly non-modular
  mfd: max77620: make it explicitly non-modular
  mfd: max77843: Make it explicitly non-modular

 drivers/mfd/max77620.c    | 12 ++----------
 drivers/mfd/max77843.c    | 24 ++----------------------
 drivers/mfd/max8925-i2c.c | 14 +-------------
 drivers/mfd/max8997.c     | 30 +++---------------------------
 drivers/mfd/max8998.c     | 27 +--------------------------
 5 files changed, 9 insertions(+), 98 deletions(-)

-- 
2.4.3

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] mfd: max8925-i2c: Make it explicitly non-modular
  2016-06-03  0:39 [PATCH v2 0/5] mfd: Make max drivers explicitly non-modular Paul Gortmaker
@ 2016-06-03  0:39 ` Paul Gortmaker
  2016-06-08 14:47   ` Lee Jones
  2016-06-03  0:39 ` [PATCH 2/5] mfd: max8997: " Paul Gortmaker
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-03  0:39 UTC (permalink / raw)
  To: linux-kernel, Lee Jones, Kyungmin Park, Javier Martinez Canillas
  Cc: Paul Gortmaker, Samuel Ortiz, Haojian Zhuang

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 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: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/mfd/max8925-i2c.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
index 70443b161a5b..5c80aea3211f 100644
--- a/drivers/mfd/max8925-i2c.c
+++ b/drivers/mfd/max8925-i2c.c
@@ -9,7 +9,7 @@
  * published by the Free Software Foundation.
  */
 #include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/i2c.h>
 #include <linux/mfd/max8925.h>
@@ -133,7 +133,6 @@ static const struct i2c_device_id max8925_id_table[] = {
 	{ "max8925", 0 },
 	{ },
 };
-MODULE_DEVICE_TABLE(i2c, max8925_id_table);
 
 static int max8925_dt_init(struct device_node *np, struct device *dev,
 			   struct max8925_platform_data *pdata)
@@ -240,7 +239,6 @@ static const struct of_device_id max8925_dt_ids[] = {
 	{ .compatible = "maxim,max8925", },
 	{},
 };
-MODULE_DEVICE_TABLE(of, max8925_dt_ids);
 
 static struct i2c_driver max8925_driver = {
 	.driver	= {
@@ -264,13 +262,3 @@ static int __init max8925_i2c_init(void)
 	return ret;
 }
 subsys_initcall(max8925_i2c_init);
-
-static void __exit max8925_i2c_exit(void)
-{
-	i2c_del_driver(&max8925_driver);
-}
-module_exit(max8925_i2c_exit);
-
-MODULE_DESCRIPTION("I2C Driver for Maxim 8925");
-MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
-MODULE_LICENSE("GPL");
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] mfd: max8997: Make it explicitly non-modular
  2016-06-03  0:39 [PATCH v2 0/5] mfd: Make max drivers explicitly non-modular Paul Gortmaker
  2016-06-03  0:39 ` [PATCH 1/5] mfd: max8925-i2c: Make it " Paul Gortmaker
@ 2016-06-03  0:39 ` Paul Gortmaker
  2016-06-08 14:47   ` Lee Jones
  2016-06-03  0:39 ` [PATCH 3/5] mfd: max8998: " Paul Gortmaker
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-03  0:39 UTC (permalink / raw)
  To: linux-kernel, Lee Jones, Kyungmin Park, Javier Martinez Canillas
  Cc: Paul Gortmaker, Samuel Ortiz, MyungJoo Ham

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_MAX8997
drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX8997/8966 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.

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: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/mfd/max8997.c | 30 +++---------------------------
 1 file changed, 3 insertions(+), 27 deletions(-)

diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
index f316348e3d98..2d6e2c392786 100644
--- a/drivers/mfd/max8997.c
+++ b/drivers/mfd/max8997.c
@@ -2,7 +2,7 @@
  * max8997.c - mfd core driver for the Maxim 8966 and 8997
  *
  * Copyright (C) 2011 Samsung Electronics
- * MyungJoo Ham <myungjoo.ham@smasung.com>
+ * MyungJoo Ham <myungjoo.ham@samsung.com>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
 #include <linux/of_irq.h>
 #include <linux/interrupt.h>
 #include <linux/pm_runtime.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/mutex.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/max8997.h>
@@ -55,7 +55,6 @@ static const struct of_device_id max8997_pmic_dt_match[] = {
 	{ .compatible = "maxim,max8997-pmic", .data = (void *)TYPE_MAX8997 },
 	{},
 };
-MODULE_DEVICE_TABLE(of, max8997_pmic_dt_match);
 #endif
 
 int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest)
@@ -263,24 +262,11 @@ err_i2c_haptic:
 	return ret;
 }
 
-static int max8997_i2c_remove(struct i2c_client *i2c)
-{
-	struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
-
-	mfd_remove_devices(max8997->dev);
-	i2c_unregister_device(max8997->muic);
-	i2c_unregister_device(max8997->haptic);
-	i2c_unregister_device(max8997->rtc);
-
-	return 0;
-}
-
 static const struct i2c_device_id max8997_i2c_id[] = {
 	{ "max8997", TYPE_MAX8997 },
 	{ "max8966", TYPE_MAX8966 },
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, max8998_i2c_id);
 
 static u8 max8997_dumpaddr_pmic[] = {
 	MAX8997_REG_INT1MSK,
@@ -510,10 +496,10 @@ static struct i2c_driver max8997_i2c_driver = {
 	.driver = {
 		   .name = "max8997",
 		   .pm = &max8997_pm,
+		   .suppress_bind_attrs = true,
 		   .of_match_table = of_match_ptr(max8997_pmic_dt_match),
 	},
 	.probe = max8997_i2c_probe,
-	.remove = max8997_i2c_remove,
 	.id_table = max8997_i2c_id,
 };
 
@@ -523,13 +509,3 @@ static int __init max8997_i2c_init(void)
 }
 /* init early so consumer devices can complete system boot */
 subsys_initcall(max8997_i2c_init);
-
-static void __exit max8997_i2c_exit(void)
-{
-	i2c_del_driver(&max8997_i2c_driver);
-}
-module_exit(max8997_i2c_exit);
-
-MODULE_DESCRIPTION("MAXIM 8997 multi-function core driver");
-MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");
-MODULE_LICENSE("GPL");
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] mfd: max8998: Make it explicitly non-modular
  2016-06-03  0:39 [PATCH v2 0/5] mfd: Make max drivers explicitly non-modular Paul Gortmaker
  2016-06-03  0:39 ` [PATCH 1/5] mfd: max8925-i2c: Make it " Paul Gortmaker
  2016-06-03  0:39 ` [PATCH 2/5] mfd: max8997: " Paul Gortmaker
@ 2016-06-03  0:39 ` Paul Gortmaker
  2016-06-08 14:48   ` Lee Jones
  2016-06-03  0:39 ` [PATCH 4/5] mfd: max77620: make " Paul Gortmaker
  2016-06-03  0:39 ` [PATCH 5/5] mfd: max77843: Make " Paul Gortmaker
  4 siblings, 1 reply; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-03  0:39 UTC (permalink / raw)
  To: linux-kernel, Lee Jones, Kyungmin Park, Javier Martinez Canillas
  Cc: Paul Gortmaker, Samuel Ortiz

The Kconfig currently controlling compilation of this code is:

mfd/Kconfig:config MFD_MAX8998
mfd/Kconfig:    bool "Maxim Semiconductor MAX8998/National LP3974 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.

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 include of
moduleparam.h too.

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: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/mfd/max8998.c | 27 +--------------------------
 1 file changed, 1 insertion(+), 26 deletions(-)

diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c
index ab28b29400f6..4c33b8063bc3 100644
--- a/drivers/mfd/max8998.c
+++ b/drivers/mfd/max8998.c
@@ -21,8 +21,6 @@
  */
 
 #include <linux/err.h>
-#include <linux/module.h>
-#include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
@@ -138,7 +136,6 @@ static const struct of_device_id max8998_dt_match[] = {
 	{ .compatible = "ti,lp3974", .data = (void *)TYPE_LP3974 },
 	{},
 };
-MODULE_DEVICE_TABLE(of, max8998_dt_match);
 #endif
 
 /*
@@ -254,23 +251,11 @@ err:
 	return ret;
 }
 
-static int max8998_i2c_remove(struct i2c_client *i2c)
-{
-	struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
-
-	mfd_remove_devices(max8998->dev);
-	max8998_irq_exit(max8998);
-	i2c_unregister_device(max8998->rtc);
-
-	return 0;
-}
-
 static const struct i2c_device_id max8998_i2c_id[] = {
 	{ "max8998", TYPE_MAX8998 },
 	{ "lp3974", TYPE_LP3974},
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, max8998_i2c_id);
 
 static int max8998_suspend(struct device *dev)
 {
@@ -378,10 +363,10 @@ static struct i2c_driver max8998_i2c_driver = {
 	.driver = {
 		   .name = "max8998",
 		   .pm = &max8998_pm,
+		   .suppress_bind_attrs = true,
 		   .of_match_table = of_match_ptr(max8998_dt_match),
 	},
 	.probe = max8998_i2c_probe,
-	.remove = max8998_i2c_remove,
 	.id_table = max8998_i2c_id,
 };
 
@@ -391,13 +376,3 @@ static int __init max8998_i2c_init(void)
 }
 /* init early so consumer devices can complete system boot */
 subsys_initcall(max8998_i2c_init);
-
-static void __exit max8998_i2c_exit(void)
-{
-	i2c_del_driver(&max8998_i2c_driver);
-}
-module_exit(max8998_i2c_exit);
-
-MODULE_DESCRIPTION("MAXIM 8998 multi-function core driver");
-MODULE_AUTHOR("Kyungmin Park <kyungmin.park@samsung.com>");
-MODULE_LICENSE("GPL");
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] mfd: max77620: make it explicitly non-modular
  2016-06-03  0:39 [PATCH v2 0/5] mfd: Make max drivers explicitly non-modular Paul Gortmaker
                   ` (2 preceding siblings ...)
  2016-06-03  0:39 ` [PATCH 3/5] mfd: max8998: " Paul Gortmaker
@ 2016-06-03  0:39 ` Paul Gortmaker
  2016-06-08 14:48   ` Lee Jones
  2016-06-03  0:39 ` [PATCH 5/5] mfd: max77843: Make " Paul Gortmaker
  4 siblings, 1 reply; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-03  0:39 UTC (permalink / raw)
  To: linux-kernel, Lee Jones, Kyungmin Park, Javier Martinez Canillas
  Cc: Paul Gortmaker, Laxman Dewangan, Chaitanya Bandi, Mallikarjun Kasoju

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_MAX77620
drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX77620 and MAX20024 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.

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
was (or is now) contained at the top of the file in the comments.

Cc: Lee Jones <lee.jones@linaro.org>
Cc: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Chaitanya Bandi <bandik@nvidia.com>
Cc: Mallikarjun Kasoju <mkasoju@nvidia.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/mfd/max77620.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c
index 199d261990be..84a830598fc9 100644
--- a/drivers/mfd/max77620.c
+++ b/drivers/mfd/max77620.c
@@ -31,7 +31,7 @@
 #include <linux/interrupt.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/max77620.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/regmap.h>
@@ -566,7 +566,6 @@ static const struct i2c_device_id max77620_id[] = {
 	{"max20024", MAX20024},
 	{},
 };
-MODULE_DEVICE_TABLE(i2c, max77620_id);
 
 static const struct dev_pm_ops max77620_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(max77620_i2c_suspend, max77620_i2c_resume)
@@ -580,11 +579,4 @@ static struct i2c_driver max77620_driver = {
 	.probe = max77620_probe,
 	.id_table = max77620_id,
 };
-
-module_i2c_driver(max77620_driver);
-
-MODULE_DESCRIPTION("MAX77620/MAX20024 Multi Function Device Core Driver");
-MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
-MODULE_AUTHOR("Chaitanya Bandi <bandik@nvidia.com>");
-MODULE_AUTHOR("Mallikarjun Kasoju <mkasoju@nvidia.com>");
-MODULE_LICENSE("GPL v2");
+builtin_i2c_driver(max77620_driver);
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] mfd: max77843: Make it explicitly non-modular
  2016-06-03  0:39 [PATCH v2 0/5] mfd: Make max drivers explicitly non-modular Paul Gortmaker
                   ` (3 preceding siblings ...)
  2016-06-03  0:39 ` [PATCH 4/5] mfd: max77620: make " Paul Gortmaker
@ 2016-06-03  0:39 ` Paul Gortmaker
  2016-06-08 14:48   ` Lee Jones
  4 siblings, 1 reply; 11+ messages in thread
From: Paul Gortmaker @ 2016-06-03  0:39 UTC (permalink / raw)
  To: linux-kernel, Lee Jones, Kyungmin Park, Javier Martinez Canillas
  Cc: Paul Gortmaker, Samuel Ortiz

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_MAX77843
drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX77843 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.

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.

Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/mfd/max77843.c | 24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/drivers/mfd/max77843.c b/drivers/mfd/max77843.c
index 7cfc95b49c5d..dc5caeaaa6a1 100644
--- a/drivers/mfd/max77843.c
+++ b/drivers/mfd/max77843.c
@@ -15,7 +15,7 @@
 #include <linux/i2c.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/max77693-common.h>
 #include <linux/mfd/max77843-private.h>
@@ -171,19 +171,6 @@ err_pmic_id:
 	return ret;
 }
 
-static int max77843_remove(struct i2c_client *i2c)
-{
-	struct max77693_dev *max77843 = i2c_get_clientdata(i2c);
-
-	mfd_remove_devices(max77843->dev);
-
-	regmap_del_irq_chip(max77843->irq, max77843->irq_data_topsys);
-
-	i2c_unregister_device(max77843->i2c_chg);
-
-	return 0;
-}
-
 static const struct of_device_id max77843_dt_match[] = {
 	{ .compatible = "maxim,max77843", },
 	{ },
@@ -193,7 +180,6 @@ static const struct i2c_device_id max77843_id[] = {
 	{ "max77843", TYPE_MAX77843, },
 	{ },
 };
-MODULE_DEVICE_TABLE(i2c, max77843_id);
 
 static int __maybe_unused max77843_suspend(struct device *dev)
 {
@@ -226,9 +212,9 @@ static struct i2c_driver max77843_i2c_driver = {
 		.name = "max77843",
 		.pm = &max77843_pm,
 		.of_match_table = max77843_dt_match,
+		.suppress_bind_attrs = true,
 	},
 	.probe = max77843_probe,
-	.remove = max77843_remove,
 	.id_table = max77843_id,
 };
 
@@ -237,9 +223,3 @@ static int __init max77843_i2c_init(void)
 	return i2c_add_driver(&max77843_i2c_driver);
 }
 subsys_initcall(max77843_i2c_init);
-
-static void __exit max77843_i2c_exit(void)
-{
-	i2c_del_driver(&max77843_i2c_driver);
-}
-module_exit(max77843_i2c_exit);
-- 
2.4.3

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/5] mfd: max8925-i2c: Make it explicitly non-modular
  2016-06-03  0:39 ` [PATCH 1/5] mfd: max8925-i2c: Make it " Paul Gortmaker
@ 2016-06-08 14:47   ` Lee Jones
  0 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2016-06-08 14:47 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Kyungmin Park, Javier Martinez Canillas,
	Samuel Ortiz, Haojian Zhuang

On Thu, 02 Jun 2016, Paul Gortmaker wrote:

> 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 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: Samuel Ortiz <sameo@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Haojian Zhuang <haojian.zhuang@marvell.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  drivers/mfd/max8925-i2c.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
> index 70443b161a5b..5c80aea3211f 100644
> --- a/drivers/mfd/max8925-i2c.c
> +++ b/drivers/mfd/max8925-i2c.c
> @@ -9,7 +9,7 @@
>   * published by the Free Software Foundation.
>   */
>  #include <linux/kernel.h>
> -#include <linux/module.h>
> +#include <linux/init.h>
>  #include <linux/platform_device.h>
>  #include <linux/i2c.h>
>  #include <linux/mfd/max8925.h>
> @@ -133,7 +133,6 @@ static const struct i2c_device_id max8925_id_table[] = {
>  	{ "max8925", 0 },
>  	{ },
>  };
> -MODULE_DEVICE_TABLE(i2c, max8925_id_table);
>  
>  static int max8925_dt_init(struct device_node *np, struct device *dev,
>  			   struct max8925_platform_data *pdata)
> @@ -240,7 +239,6 @@ static const struct of_device_id max8925_dt_ids[] = {
>  	{ .compatible = "maxim,max8925", },
>  	{},
>  };
> -MODULE_DEVICE_TABLE(of, max8925_dt_ids);
>  
>  static struct i2c_driver max8925_driver = {
>  	.driver	= {
> @@ -264,13 +262,3 @@ static int __init max8925_i2c_init(void)
>  	return ret;
>  }
>  subsys_initcall(max8925_i2c_init);
> -
> -static void __exit max8925_i2c_exit(void)
> -{
> -	i2c_del_driver(&max8925_driver);
> -}
> -module_exit(max8925_i2c_exit);
> -
> -MODULE_DESCRIPTION("I2C Driver for Maxim 8925");
> -MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
> -MODULE_LICENSE("GPL");

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/5] mfd: max8997: Make it explicitly non-modular
  2016-06-03  0:39 ` [PATCH 2/5] mfd: max8997: " Paul Gortmaker
@ 2016-06-08 14:47   ` Lee Jones
  0 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2016-06-08 14:47 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Kyungmin Park, Javier Martinez Canillas,
	Samuel Ortiz, MyungJoo Ham

On Thu, 02 Jun 2016, Paul Gortmaker wrote:

> The Kconfig currently controlling compilation of this code is:
> 
> drivers/mfd/Kconfig:config MFD_MAX8997
> drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX8997/8966 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.
> 
> 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: Samuel Ortiz <sameo@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  drivers/mfd/max8997.c | 30 +++---------------------------
>  1 file changed, 3 insertions(+), 27 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/max8997.c b/drivers/mfd/max8997.c
> index f316348e3d98..2d6e2c392786 100644
> --- a/drivers/mfd/max8997.c
> +++ b/drivers/mfd/max8997.c
> @@ -2,7 +2,7 @@
>   * max8997.c - mfd core driver for the Maxim 8966 and 8997
>   *
>   * Copyright (C) 2011 Samsung Electronics
> - * MyungJoo Ham <myungjoo.ham@smasung.com>
> + * MyungJoo Ham <myungjoo.ham@samsung.com>
>   *
>   * This program is free software; you can redistribute it and/or modify
>   * it under the terms of the GNU General Public License as published by
> @@ -28,7 +28,7 @@
>  #include <linux/of_irq.h>
>  #include <linux/interrupt.h>
>  #include <linux/pm_runtime.h>
> -#include <linux/module.h>
> +#include <linux/init.h>
>  #include <linux/mutex.h>
>  #include <linux/mfd/core.h>
>  #include <linux/mfd/max8997.h>
> @@ -55,7 +55,6 @@ static const struct of_device_id max8997_pmic_dt_match[] = {
>  	{ .compatible = "maxim,max8997-pmic", .data = (void *)TYPE_MAX8997 },
>  	{},
>  };
> -MODULE_DEVICE_TABLE(of, max8997_pmic_dt_match);
>  #endif
>  
>  int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest)
> @@ -263,24 +262,11 @@ err_i2c_haptic:
>  	return ret;
>  }
>  
> -static int max8997_i2c_remove(struct i2c_client *i2c)
> -{
> -	struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
> -
> -	mfd_remove_devices(max8997->dev);
> -	i2c_unregister_device(max8997->muic);
> -	i2c_unregister_device(max8997->haptic);
> -	i2c_unregister_device(max8997->rtc);
> -
> -	return 0;
> -}
> -
>  static const struct i2c_device_id max8997_i2c_id[] = {
>  	{ "max8997", TYPE_MAX8997 },
>  	{ "max8966", TYPE_MAX8966 },
>  	{ }
>  };
> -MODULE_DEVICE_TABLE(i2c, max8998_i2c_id);
>  
>  static u8 max8997_dumpaddr_pmic[] = {
>  	MAX8997_REG_INT1MSK,
> @@ -510,10 +496,10 @@ static struct i2c_driver max8997_i2c_driver = {
>  	.driver = {
>  		   .name = "max8997",
>  		   .pm = &max8997_pm,
> +		   .suppress_bind_attrs = true,
>  		   .of_match_table = of_match_ptr(max8997_pmic_dt_match),
>  	},
>  	.probe = max8997_i2c_probe,
> -	.remove = max8997_i2c_remove,
>  	.id_table = max8997_i2c_id,
>  };
>  
> @@ -523,13 +509,3 @@ static int __init max8997_i2c_init(void)
>  }
>  /* init early so consumer devices can complete system boot */
>  subsys_initcall(max8997_i2c_init);
> -
> -static void __exit max8997_i2c_exit(void)
> -{
> -	i2c_del_driver(&max8997_i2c_driver);
> -}
> -module_exit(max8997_i2c_exit);
> -
> -MODULE_DESCRIPTION("MAXIM 8997 multi-function core driver");
> -MODULE_AUTHOR("MyungJoo Ham <myungjoo.ham@samsung.com>");
> -MODULE_LICENSE("GPL");

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/5] mfd: max8998: Make it explicitly non-modular
  2016-06-03  0:39 ` [PATCH 3/5] mfd: max8998: " Paul Gortmaker
@ 2016-06-08 14:48   ` Lee Jones
  0 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2016-06-08 14:48 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Kyungmin Park, Javier Martinez Canillas, Samuel Ortiz

On Thu, 02 Jun 2016, Paul Gortmaker wrote:

> The Kconfig currently controlling compilation of this code is:
> 
> mfd/Kconfig:config MFD_MAX8998
> mfd/Kconfig:    bool "Maxim Semiconductor MAX8998/National LP3974 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.
> 
> 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 include of
> moduleparam.h too.
> 
> 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: Samuel Ortiz <sameo@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  drivers/mfd/max8998.c | 27 +--------------------------
>  1 file changed, 1 insertion(+), 26 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/max8998.c b/drivers/mfd/max8998.c
> index ab28b29400f6..4c33b8063bc3 100644
> --- a/drivers/mfd/max8998.c
> +++ b/drivers/mfd/max8998.c
> @@ -21,8 +21,6 @@
>   */
>  
>  #include <linux/err.h>
> -#include <linux/module.h>
> -#include <linux/moduleparam.h>
>  #include <linux/init.h>
>  #include <linux/slab.h>
>  #include <linux/i2c.h>
> @@ -138,7 +136,6 @@ static const struct of_device_id max8998_dt_match[] = {
>  	{ .compatible = "ti,lp3974", .data = (void *)TYPE_LP3974 },
>  	{},
>  };
> -MODULE_DEVICE_TABLE(of, max8998_dt_match);
>  #endif
>  
>  /*
> @@ -254,23 +251,11 @@ err:
>  	return ret;
>  }
>  
> -static int max8998_i2c_remove(struct i2c_client *i2c)
> -{
> -	struct max8998_dev *max8998 = i2c_get_clientdata(i2c);
> -
> -	mfd_remove_devices(max8998->dev);
> -	max8998_irq_exit(max8998);
> -	i2c_unregister_device(max8998->rtc);
> -
> -	return 0;
> -}
> -
>  static const struct i2c_device_id max8998_i2c_id[] = {
>  	{ "max8998", TYPE_MAX8998 },
>  	{ "lp3974", TYPE_LP3974},
>  	{ }
>  };
> -MODULE_DEVICE_TABLE(i2c, max8998_i2c_id);
>  
>  static int max8998_suspend(struct device *dev)
>  {
> @@ -378,10 +363,10 @@ static struct i2c_driver max8998_i2c_driver = {
>  	.driver = {
>  		   .name = "max8998",
>  		   .pm = &max8998_pm,
> +		   .suppress_bind_attrs = true,
>  		   .of_match_table = of_match_ptr(max8998_dt_match),
>  	},
>  	.probe = max8998_i2c_probe,
> -	.remove = max8998_i2c_remove,
>  	.id_table = max8998_i2c_id,
>  };
>  
> @@ -391,13 +376,3 @@ static int __init max8998_i2c_init(void)
>  }
>  /* init early so consumer devices can complete system boot */
>  subsys_initcall(max8998_i2c_init);
> -
> -static void __exit max8998_i2c_exit(void)
> -{
> -	i2c_del_driver(&max8998_i2c_driver);
> -}
> -module_exit(max8998_i2c_exit);
> -
> -MODULE_DESCRIPTION("MAXIM 8998 multi-function core driver");
> -MODULE_AUTHOR("Kyungmin Park <kyungmin.park@samsung.com>");
> -MODULE_LICENSE("GPL");

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/5] mfd: max77620: make it explicitly non-modular
  2016-06-03  0:39 ` [PATCH 4/5] mfd: max77620: make " Paul Gortmaker
@ 2016-06-08 14:48   ` Lee Jones
  0 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2016-06-08 14:48 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Kyungmin Park, Javier Martinez Canillas,
	Laxman Dewangan, Chaitanya Bandi, Mallikarjun Kasoju

On Thu, 02 Jun 2016, Paul Gortmaker wrote:

> The Kconfig currently controlling compilation of this code is:
> 
> drivers/mfd/Kconfig:config MFD_MAX77620
> drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX77620 and MAX20024 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.
> 
> 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
> was (or is now) contained at the top of the file in the comments.
> 
> Cc: Lee Jones <lee.jones@linaro.org>
> Cc: Laxman Dewangan <ldewangan@nvidia.com>
> Cc: Chaitanya Bandi <bandik@nvidia.com>
> Cc: Mallikarjun Kasoju <mkasoju@nvidia.com>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  drivers/mfd/max77620.c | 12 ++----------
>  1 file changed, 2 insertions(+), 10 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c
> index 199d261990be..84a830598fc9 100644
> --- a/drivers/mfd/max77620.c
> +++ b/drivers/mfd/max77620.c
> @@ -31,7 +31,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/mfd/core.h>
>  #include <linux/mfd/max77620.h>
> -#include <linux/module.h>
> +#include <linux/init.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
>  #include <linux/regmap.h>
> @@ -566,7 +566,6 @@ static const struct i2c_device_id max77620_id[] = {
>  	{"max20024", MAX20024},
>  	{},
>  };
> -MODULE_DEVICE_TABLE(i2c, max77620_id);
>  
>  static const struct dev_pm_ops max77620_pm_ops = {
>  	SET_SYSTEM_SLEEP_PM_OPS(max77620_i2c_suspend, max77620_i2c_resume)
> @@ -580,11 +579,4 @@ static struct i2c_driver max77620_driver = {
>  	.probe = max77620_probe,
>  	.id_table = max77620_id,
>  };
> -
> -module_i2c_driver(max77620_driver);
> -
> -MODULE_DESCRIPTION("MAX77620/MAX20024 Multi Function Device Core Driver");
> -MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
> -MODULE_AUTHOR("Chaitanya Bandi <bandik@nvidia.com>");
> -MODULE_AUTHOR("Mallikarjun Kasoju <mkasoju@nvidia.com>");
> -MODULE_LICENSE("GPL v2");
> +builtin_i2c_driver(max77620_driver);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/5] mfd: max77843: Make it explicitly non-modular
  2016-06-03  0:39 ` [PATCH 5/5] mfd: max77843: Make " Paul Gortmaker
@ 2016-06-08 14:48   ` Lee Jones
  0 siblings, 0 replies; 11+ messages in thread
From: Lee Jones @ 2016-06-08 14:48 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Kyungmin Park, Javier Martinez Canillas, Samuel Ortiz

On Thu, 02 Jun 2016, Paul Gortmaker wrote:

> The Kconfig currently controlling compilation of this code is:
> 
> drivers/mfd/Kconfig:config MFD_MAX77843
> drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX77843 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.
> 
> 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.
> 
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
>  drivers/mfd/max77843.c | 24 ++----------------------
>  1 file changed, 2 insertions(+), 22 deletions(-)

Applied, thanks.

> diff --git a/drivers/mfd/max77843.c b/drivers/mfd/max77843.c
> index 7cfc95b49c5d..dc5caeaaa6a1 100644
> --- a/drivers/mfd/max77843.c
> +++ b/drivers/mfd/max77843.c
> @@ -15,7 +15,7 @@
>  #include <linux/i2c.h>
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
> -#include <linux/module.h>
> +#include <linux/init.h>
>  #include <linux/mfd/core.h>
>  #include <linux/mfd/max77693-common.h>
>  #include <linux/mfd/max77843-private.h>
> @@ -171,19 +171,6 @@ err_pmic_id:
>  	return ret;
>  }
>  
> -static int max77843_remove(struct i2c_client *i2c)
> -{
> -	struct max77693_dev *max77843 = i2c_get_clientdata(i2c);
> -
> -	mfd_remove_devices(max77843->dev);
> -
> -	regmap_del_irq_chip(max77843->irq, max77843->irq_data_topsys);
> -
> -	i2c_unregister_device(max77843->i2c_chg);
> -
> -	return 0;
> -}
> -
>  static const struct of_device_id max77843_dt_match[] = {
>  	{ .compatible = "maxim,max77843", },
>  	{ },
> @@ -193,7 +180,6 @@ static const struct i2c_device_id max77843_id[] = {
>  	{ "max77843", TYPE_MAX77843, },
>  	{ },
>  };
> -MODULE_DEVICE_TABLE(i2c, max77843_id);
>  
>  static int __maybe_unused max77843_suspend(struct device *dev)
>  {
> @@ -226,9 +212,9 @@ static struct i2c_driver max77843_i2c_driver = {
>  		.name = "max77843",
>  		.pm = &max77843_pm,
>  		.of_match_table = max77843_dt_match,
> +		.suppress_bind_attrs = true,
>  	},
>  	.probe = max77843_probe,
> -	.remove = max77843_remove,
>  	.id_table = max77843_id,
>  };
>  
> @@ -237,9 +223,3 @@ static int __init max77843_i2c_init(void)
>  	return i2c_add_driver(&max77843_i2c_driver);
>  }
>  subsys_initcall(max77843_i2c_init);
> -
> -static void __exit max77843_i2c_exit(void)
> -{
> -	i2c_del_driver(&max77843_i2c_driver);
> -}
> -module_exit(max77843_i2c_exit);

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-06-08 14:48 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-03  0:39 [PATCH v2 0/5] mfd: Make max drivers explicitly non-modular Paul Gortmaker
2016-06-03  0:39 ` [PATCH 1/5] mfd: max8925-i2c: Make it " Paul Gortmaker
2016-06-08 14:47   ` Lee Jones
2016-06-03  0:39 ` [PATCH 2/5] mfd: max8997: " Paul Gortmaker
2016-06-08 14:47   ` Lee Jones
2016-06-03  0:39 ` [PATCH 3/5] mfd: max8998: " Paul Gortmaker
2016-06-08 14:48   ` Lee Jones
2016-06-03  0:39 ` [PATCH 4/5] mfd: max77620: make " Paul Gortmaker
2016-06-08 14:48   ` Lee Jones
2016-06-03  0:39 ` [PATCH 5/5] mfd: max77843: Make " Paul Gortmaker
2016-06-08 14:48   ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).