linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular
@ 2016-04-03 21:24 Paul Gortmaker
  2016-04-03 21:24 ` [PATCH 1/7] drivers/mfd: make max8925-i2c.c " Paul Gortmaker
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-03 21:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Chanwoo Choi, Haojian Zhuang,
	Krzysztof Kozlowski, Kyungmin Park, Lee Jones, 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.
---

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: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>

Paul Gortmaker (7):
  drivers/mfd: make max8925-i2c.c explicitly non-modular
  drivers/mfd: make max8997.c explicitly non-modular
  drivers/mfd: make max8998.c explicitly non-modular
  drivers/mfd: make max14577.c explicitly non-modular
  drivers/mfd: make max77686.c explicitly non-modular
  drivers/mfd: make max77693.c explicitly non-modular
  drivers/mfd: make max77843.c explicitly non-modular

 drivers/mfd/max14577.c    | 13 +------------
 drivers/mfd/max77686.c    | 26 ++------------------------
 drivers/mfd/max77693.c    | 34 +++-------------------------------
 drivers/mfd/max77843.c    | 24 ++----------------------
 drivers/mfd/max8925-i2c.c | 14 +-------------
 drivers/mfd/max8997.c     | 30 +++---------------------------
 drivers/mfd/max8998.c     | 27 +--------------------------
 7 files changed, 13 insertions(+), 155 deletions(-)

-- 
2.8.0

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

* [PATCH 1/7] drivers/mfd: make max8925-i2c.c explicitly non-modular
  2016-04-03 21:24 [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular Paul Gortmaker
@ 2016-04-03 21:24 ` Paul Gortmaker
  2016-04-03 21:24 ` [PATCH 2/7] drivers/mfd: make max8997.c " Paul Gortmaker
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-03 21:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Gortmaker, Samuel Ortiz, Lee Jones, 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.8.0

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

* [PATCH 2/7] drivers/mfd: make max8997.c explicitly non-modular
  2016-04-03 21:24 [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular Paul Gortmaker
  2016-04-03 21:24 ` [PATCH 1/7] drivers/mfd: make max8925-i2c.c " Paul Gortmaker
@ 2016-04-03 21:24 ` Paul Gortmaker
  2016-04-03 21:24 ` [PATCH 3/7] drivers/mfd: make max8998.c " Paul Gortmaker
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-03 21:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Gortmaker, Samuel Ortiz, Lee Jones, 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.8.0

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

* [PATCH 3/7] drivers/mfd: make max8998.c explicitly non-modular
  2016-04-03 21:24 [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular Paul Gortmaker
  2016-04-03 21:24 ` [PATCH 1/7] drivers/mfd: make max8925-i2c.c " Paul Gortmaker
  2016-04-03 21:24 ` [PATCH 2/7] drivers/mfd: make max8997.c " Paul Gortmaker
@ 2016-04-03 21:24 ` Paul Gortmaker
  2016-04-03 21:24 ` [PATCH 4/7] drivers/mfd: make max14577.c " Paul Gortmaker
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-03 21:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Gortmaker, Samuel Ortiz, Lee Jones, Kyungmin Park

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

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

* [PATCH 4/7] drivers/mfd: make max14577.c explicitly non-modular
  2016-04-03 21:24 [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular Paul Gortmaker
                   ` (2 preceding siblings ...)
  2016-04-03 21:24 ` [PATCH 3/7] drivers/mfd: make max8998.c " Paul Gortmaker
@ 2016-04-03 21:24 ` Paul Gortmaker
  2016-04-04  3:42   ` Krzysztof Kozlowski
  2016-04-03 21:24 ` [PATCH 5/7] drivers/mfd: make max77686.c " Paul Gortmaker
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-03 21:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Chanwoo Choi, Krzysztof Kozlowski, Samuel Ortiz,
	Lee Jones

The Kconfig currently controlling compilation of this code is:

mfd/Kconfig:config MFD_MAX14577
mfd/Kconfig:   bool "Maxim Semiconductor MAX14577/77836 MUIC + Charger 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: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
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/max14577.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c
index 2280b3fdcf68..9c0eb4efe246 100644
--- a/drivers/mfd/max14577.c
+++ b/drivers/mfd/max14577.c
@@ -19,7 +19,7 @@
  */
 
 #include <linux/err.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/of_device.h>
 #include <linux/mfd/core.h>
@@ -490,7 +490,6 @@ static const struct i2c_device_id max14577_i2c_id[] = {
 	{ "max77836", MAXIM_DEVICE_TYPE_MAX77836, },
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, max14577_i2c_id);
 
 #ifdef CONFIG_PM_SLEEP
 static int max14577_suspend(struct device *dev)
@@ -562,13 +561,3 @@ static int __init max14577_i2c_init(void)
 	return i2c_add_driver(&max14577_i2c_driver);
 }
 subsys_initcall(max14577_i2c_init);
-
-static void __exit max14577_i2c_exit(void)
-{
-	i2c_del_driver(&max14577_i2c_driver);
-}
-module_exit(max14577_i2c_exit);
-
-MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>, Krzysztof Kozlowski <k.kozlowski@samsung.com>");
-MODULE_DESCRIPTION("Maxim 14577/77836 multi-function core driver");
-MODULE_LICENSE("GPL");
-- 
2.8.0

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

* [PATCH 5/7] drivers/mfd: make max77686.c explicitly non-modular
  2016-04-03 21:24 [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular Paul Gortmaker
                   ` (3 preceding siblings ...)
  2016-04-03 21:24 ` [PATCH 4/7] drivers/mfd: make max14577.c " Paul Gortmaker
@ 2016-04-03 21:24 ` Paul Gortmaker
  2016-04-04  3:44   ` Krzysztof Kozlowski
  2016-04-03 21:24 ` [PATCH 6/7] drivers/mfd: make max77693.c " Paul Gortmaker
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-03 21:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Chanwoo Choi, Krzysztof Kozlowski, Samuel Ortiz,
	Lee Jones

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_MAX77686
drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX77686/802 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: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
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/max77686.c | 26 ++------------------------
 1 file changed, 2 insertions(+), 24 deletions(-)

diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c
index c1aff46e89d9..d9d47040a49a 100644
--- a/drivers/mfd/max77686.c
+++ b/drivers/mfd/max77686.c
@@ -28,7 +28,7 @@
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/pm_runtime.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/mfd/core.h>
 #include <linux/mfd/max77686.h>
 #include <linux/mfd/max77686-private.h>
@@ -253,23 +253,11 @@ err_del_irqc:
 	return ret;
 }
 
-static int max77686_i2c_remove(struct i2c_client *i2c)
-{
-	struct max77686_dev *max77686 = i2c_get_clientdata(i2c);
-
-	mfd_remove_devices(max77686->dev);
-
-	regmap_del_irq_chip(max77686->irq, max77686->irq_data);
-
-	return 0;
-}
-
 static const struct i2c_device_id max77686_i2c_id[] = {
 	{ "max77686", TYPE_MAX77686 },
 	{ "max77802", TYPE_MAX77802 },
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, max77686_i2c_id);
 
 #ifdef CONFIG_PM_SLEEP
 static int max77686_suspend(struct device *dev)
@@ -314,10 +302,10 @@ static struct i2c_driver max77686_i2c_driver = {
 	.driver = {
 		   .name = "max77686",
 		   .pm = &max77686_pm,
+		   .suppress_bind_attrs = true,
 		   .of_match_table = of_match_ptr(max77686_pmic_dt_match),
 	},
 	.probe = max77686_i2c_probe,
-	.remove = max77686_i2c_remove,
 	.id_table = max77686_i2c_id,
 };
 
@@ -327,13 +315,3 @@ static int __init max77686_i2c_init(void)
 }
 /* init early so consumer devices can complete system boot */
 subsys_initcall(max77686_i2c_init);
-
-static void __exit max77686_i2c_exit(void)
-{
-	i2c_del_driver(&max77686_i2c_driver);
-}
-module_exit(max77686_i2c_exit);
-
-MODULE_DESCRIPTION("MAXIM 77686/802 multi-function core driver");
-MODULE_AUTHOR("Chiwoong Byun <woong.byun@samsung.com>");
-MODULE_LICENSE("GPL");
-- 
2.8.0

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

* [PATCH 6/7] drivers/mfd: make max77693.c explicitly non-modular
  2016-04-03 21:24 [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular Paul Gortmaker
                   ` (4 preceding siblings ...)
  2016-04-03 21:24 ` [PATCH 5/7] drivers/mfd: make max77686.c " Paul Gortmaker
@ 2016-04-03 21:24 ` Paul Gortmaker
  2016-04-04  3:53   ` Krzysztof Kozlowski
  2016-04-03 21:24 ` [PATCH 7/7] drivers/mfd: make max77843.c " Paul Gortmaker
  2016-04-04  8:11 ` [PATCH 0/7] drivers/mfd: make max drivers " Lee Jones
  7 siblings, 1 reply; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-03 21:24 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Chanwoo Choi, Krzysztof Kozlowski, Samuel Ortiz,
	Lee Jones

The Kconfig currently controlling compilation of this code is:

drivers/mfd/Kconfig:config MFD_MAX77693
drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX77693 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
was contained at the top of the file in the comments.

Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
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/max77693.c | 34 +++-------------------------------
 1 file changed, 3 insertions(+), 31 deletions(-)

diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
index b83b7a7da1ae..4126a55269d2 100644
--- a/drivers/mfd/max77693.c
+++ b/drivers/mfd/max77693.c
@@ -2,7 +2,7 @@
  * max77693.c - mfd core driver for the MAX 77693
  *
  * Copyright (C) 2012 Samsung Electronics
- * SangYoung Son <hello.son@smasung.com>
+ * SangYoung Son <hello.son@samsung.com>
  *
  * This program is not provided / owned by Maxim Integrated Products.
  *
@@ -23,7 +23,7 @@
  * This driver is based on max8997.c
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/err.h>
@@ -309,28 +309,10 @@ err_i2c_haptic:
 	return ret;
 }
 
-static int max77693_i2c_remove(struct i2c_client *i2c)
-{
-	struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
-
-	mfd_remove_devices(max77693->dev);
-
-	regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
-	regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg);
-	regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
-	regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
-
-	i2c_unregister_device(max77693->i2c_muic);
-	i2c_unregister_device(max77693->i2c_haptic);
-
-	return 0;
-}
-
 static const struct i2c_device_id max77693_i2c_id[] = {
 	{ "max77693", TYPE_MAX77693 },
 	{ }
 };
-MODULE_DEVICE_TABLE(i2c, max77693_i2c_id);
 
 static int max77693_suspend(struct device *dev)
 {
@@ -374,10 +356,10 @@ static struct i2c_driver max77693_i2c_driver = {
 	.driver = {
 		   .name = "max77693",
 		   .pm = &max77693_pm,
+		   .suppress_bind_attrs = true,
 		   .of_match_table = of_match_ptr(max77693_dt_match),
 	},
 	.probe = max77693_i2c_probe,
-	.remove = max77693_i2c_remove,
 	.id_table = max77693_i2c_id,
 };
 
@@ -387,13 +369,3 @@ static int __init max77693_i2c_init(void)
 }
 /* init early so consumer devices can complete system boot */
 subsys_initcall(max77693_i2c_init);
-
-static void __exit max77693_i2c_exit(void)
-{
-	i2c_del_driver(&max77693_i2c_driver);
-}
-module_exit(max77693_i2c_exit);
-
-MODULE_DESCRIPTION("MAXIM 77693 multi-function core driver");
-MODULE_AUTHOR("SangYoung, Son <hello.son@samsung.com>");
-MODULE_LICENSE("GPL");
-- 
2.8.0

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

* [PATCH 7/7] drivers/mfd: make max77843.c explicitly non-modular
  2016-04-03 21:24 [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular Paul Gortmaker
                   ` (5 preceding siblings ...)
  2016-04-03 21:24 ` [PATCH 6/7] drivers/mfd: make max77693.c " Paul Gortmaker
@ 2016-04-03 21:24 ` Paul Gortmaker
  2016-04-04  8:11 ` [PATCH 0/7] drivers/mfd: make max drivers " Lee Jones
  7 siblings, 0 replies; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-03 21:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Paul Gortmaker, Samuel Ortiz, Lee Jones

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

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

* Re: [PATCH 4/7] drivers/mfd: make max14577.c explicitly non-modular
  2016-04-03 21:24 ` [PATCH 4/7] drivers/mfd: make max14577.c " Paul Gortmaker
@ 2016-04-04  3:42   ` Krzysztof Kozlowski
  2016-04-04 15:09     ` Paul Gortmaker
  2016-04-05 14:24     ` Javier Martinez Canillas
  0 siblings, 2 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2016-04-04  3:42 UTC (permalink / raw)
  To: Paul Gortmaker, linux-kernel
  Cc: Chanwoo Choi, Samuel Ortiz, Lee Jones, Javier Martinez Canillas

On 04.04.2016 06:24, Paul Gortmaker wrote:
> The Kconfig currently controlling compilation of this code is:
> 
> mfd/Kconfig:config MFD_MAX14577
> mfd/Kconfig:   bool "Maxim Semiconductor MAX14577/77836 MUIC + Charger 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: Chanwoo Choi <cw00.choi@samsung.com>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 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/max14577.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)

+Cc Javier,

In general I agree with the patchset except maybe here because it
conflicts with Javier's work to make it a module:
mfd: max14577: Use module_init() instead of subsys_initcall()
http://www.spinics.net/lists/kernel/msg2213747.html

Javier's patchset is however missing a tested-by tag so maybe this is
why it was not merged.

Unfortunately I cannot provide testing because my current device with
max14577/max77836 is dead and its recovery is not easy. Maybe I will get
a proper device in a few weeks after going back to Poland.

My proposal would be to wait with this max14577 change a little bit.

Best regards,
Krzysztof

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

* Re: [PATCH 5/7] drivers/mfd: make max77686.c explicitly non-modular
  2016-04-03 21:24 ` [PATCH 5/7] drivers/mfd: make max77686.c " Paul Gortmaker
@ 2016-04-04  3:44   ` Krzysztof Kozlowski
  2016-04-04 15:08     ` Paul Gortmaker
  2016-04-04 15:21     ` Javier Martinez Canillas
  0 siblings, 2 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2016-04-04  3:44 UTC (permalink / raw)
  To: Paul Gortmaker, linux-kernel
  Cc: Chanwoo Choi, Samuel Ortiz, Lee Jones, Javier Martinez Canillas

On 04.04.2016 06:24, Paul Gortmaker wrote:
> The Kconfig currently controlling compilation of this code is:
> 
> drivers/mfd/Kconfig:config MFD_MAX77686
> drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX77686/802 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: Chanwoo Choi <cw00.choi@samsung.com>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 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/max77686.c | 26 ++------------------------
>  1 file changed, 2 insertions(+), 24 deletions(-)

+Cc Javier,

I think we want to proceed with Javier's work for max77686:
mfd: max77686: Allow the driver to be built as a module
http://lkml.iu.edu/hypermail/linux/kernel/1602.1/03921.html

Javier, what is the status of your patchset? What do you need?

Best regards,
Krzysztof

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

* Re: [PATCH 6/7] drivers/mfd: make max77693.c explicitly non-modular
  2016-04-03 21:24 ` [PATCH 6/7] drivers/mfd: make max77693.c " Paul Gortmaker
@ 2016-04-04  3:53   ` Krzysztof Kozlowski
  2016-04-04 15:39     ` Paul Gortmaker
  0 siblings, 1 reply; 20+ messages in thread
From: Krzysztof Kozlowski @ 2016-04-04  3:53 UTC (permalink / raw)
  To: Paul Gortmaker, linux-kernel; +Cc: Chanwoo Choi, Samuel Ortiz, Lee Jones

On 04.04.2016 06:24, Paul Gortmaker wrote:
> The Kconfig currently controlling compilation of this code is:
> 
> drivers/mfd/Kconfig:config MFD_MAX77693
> drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX77693 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
> was contained at the top of the file in the comments.
> 
> Cc: Chanwoo Choi <cw00.choi@samsung.com>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> 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/max77693.c | 34 +++-------------------------------
>  1 file changed, 3 insertions(+), 31 deletions(-)
> 
> diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
> index b83b7a7da1ae..4126a55269d2 100644
> --- a/drivers/mfd/max77693.c
> +++ b/drivers/mfd/max77693.c
> @@ -2,7 +2,7 @@
>   * max77693.c - mfd core driver for the MAX 77693
>   *
>   * Copyright (C) 2012 Samsung Electronics
> - * SangYoung Son <hello.son@smasung.com>
> + * SangYoung Son <hello.son@samsung.com>
>   *

That's good change.

As for the rest, I think the driver can be switch to module. Consumer
(phy-samsung-usb2) support deferred probing. I can prepare and test a
patch for that.

Best regards,
Krzysztof

>   * This program is not provided / owned by Maxim Integrated Products.
>   *
> @@ -23,7 +23,7 @@
>   * This driver is based on max8997.c
>   */
>  
> -#include <linux/module.h>
> +#include <linux/init.h>
>  #include <linux/slab.h>
>  #include <linux/i2c.h>
>  #include <linux/err.h>
> @@ -309,28 +309,10 @@ err_i2c_haptic:
>  	return ret;
>  }
>  
> -static int max77693_i2c_remove(struct i2c_client *i2c)
> -{
> -	struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
> -
> -	mfd_remove_devices(max77693->dev);
> -
> -	regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
> -	regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg);
> -	regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
> -	regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
> -
> -	i2c_unregister_device(max77693->i2c_muic);
> -	i2c_unregister_device(max77693->i2c_haptic);
> -
> -	return 0;
> -}
> -
>  static const struct i2c_device_id max77693_i2c_id[] = {
>  	{ "max77693", TYPE_MAX77693 },
>  	{ }
>  };
> -MODULE_DEVICE_TABLE(i2c, max77693_i2c_id);
>  
>  static int max77693_suspend(struct device *dev)
>  {
> @@ -374,10 +356,10 @@ static struct i2c_driver max77693_i2c_driver = {
>  	.driver = {
>  		   .name = "max77693",
>  		   .pm = &max77693_pm,
> +		   .suppress_bind_attrs = true,
>  		   .of_match_table = of_match_ptr(max77693_dt_match),
>  	},
>  	.probe = max77693_i2c_probe,
> -	.remove = max77693_i2c_remove,
>  	.id_table = max77693_i2c_id,
>  };
>  
> @@ -387,13 +369,3 @@ static int __init max77693_i2c_init(void)
>  }
>  /* init early so consumer devices can complete system boot */
>  subsys_initcall(max77693_i2c_init);
> -
> -static void __exit max77693_i2c_exit(void)
> -{
> -	i2c_del_driver(&max77693_i2c_driver);
> -}
> -module_exit(max77693_i2c_exit);
> -
> -MODULE_DESCRIPTION("MAXIM 77693 multi-function core driver");
> -MODULE_AUTHOR("SangYoung, Son <hello.son@samsung.com>");
> -MODULE_LICENSE("GPL");
> 

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

* Re: [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular
  2016-04-03 21:24 [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular Paul Gortmaker
                   ` (6 preceding siblings ...)
  2016-04-03 21:24 ` [PATCH 7/7] drivers/mfd: make max77843.c " Paul Gortmaker
@ 2016-04-04  8:11 ` Lee Jones
  2016-04-04 13:51   ` Paul Gortmaker
  7 siblings, 1 reply; 20+ messages in thread
From: Lee Jones @ 2016-04-04  8:11 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Chanwoo Choi, Haojian Zhuang, Krzysztof Kozlowski,
	Kyungmin Park, MyungJoo Ham, Samuel Ortiz

How did you come up with the subject lines for these patches?

Please do `git log --oneline -- <subsystem>`, as is normal when
submitting to mainline.

> 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.
> ---
> 
> 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: MyungJoo Ham <myungjoo.ham@samsung.com>
> Cc: Samuel Ortiz <sameo@linux.intel.com>
> 
> Paul Gortmaker (7):
>   drivers/mfd: make max8925-i2c.c explicitly non-modular
>   drivers/mfd: make max8997.c explicitly non-modular
>   drivers/mfd: make max8998.c explicitly non-modular
>   drivers/mfd: make max14577.c explicitly non-modular
>   drivers/mfd: make max77686.c explicitly non-modular
>   drivers/mfd: make max77693.c explicitly non-modular
>   drivers/mfd: make max77843.c explicitly non-modular
> 
>  drivers/mfd/max14577.c    | 13 +------------
>  drivers/mfd/max77686.c    | 26 ++------------------------
>  drivers/mfd/max77693.c    | 34 +++-------------------------------
>  drivers/mfd/max77843.c    | 24 ++----------------------
>  drivers/mfd/max8925-i2c.c | 14 +-------------
>  drivers/mfd/max8997.c     | 30 +++---------------------------
>  drivers/mfd/max8998.c     | 27 +--------------------------
>  7 files changed, 13 insertions(+), 155 deletions(-)
> 

-- 
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] 20+ messages in thread

* Re: [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular
  2016-04-04  8:11 ` [PATCH 0/7] drivers/mfd: make max drivers " Lee Jones
@ 2016-04-04 13:51   ` Paul Gortmaker
  2016-04-04 14:21     ` Lee Jones
  0 siblings, 1 reply; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-04 13:51 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, Chanwoo Choi, Haojian Zhuang, Krzysztof Kozlowski,
	Kyungmin Park, MyungJoo Ham, Samuel Ortiz

[Re: [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular] On 04/04/2016 (Mon 09:11) Lee Jones wrote:

> How did you come up with the subject lines for these patches?

I just used the general default of:
   <path_to_subsystem>: rest of subject

> 
> Please do `git log --oneline -- <subsystem>`, as is normal when
> submitting to mainline.

Just to be clear, looking at other mfd history, you want me to just
drop the "drivers/" prefix ; i.e. change from:

   drivers/mfd: text text text driver.c text

...to:

   mfd: text text text driver.c text

If so, that is no problem and I can do that for the next revision when I
drop the patches pending tristate conversion that I wasn't aware of.

Thanks,
Paul.
--

> 
> > 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.
> > ---
> > 
> > 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: MyungJoo Ham <myungjoo.ham@samsung.com>
> > Cc: Samuel Ortiz <sameo@linux.intel.com>
> > 
> > Paul Gortmaker (7):
> >   drivers/mfd: make max8925-i2c.c explicitly non-modular
> >   drivers/mfd: make max8997.c explicitly non-modular
> >   drivers/mfd: make max8998.c explicitly non-modular
> >   drivers/mfd: make max14577.c explicitly non-modular
> >   drivers/mfd: make max77686.c explicitly non-modular
> >   drivers/mfd: make max77693.c explicitly non-modular
> >   drivers/mfd: make max77843.c explicitly non-modular
> > 
> >  drivers/mfd/max14577.c    | 13 +------------
> >  drivers/mfd/max77686.c    | 26 ++------------------------
> >  drivers/mfd/max77693.c    | 34 +++-------------------------------
> >  drivers/mfd/max77843.c    | 24 ++----------------------
> >  drivers/mfd/max8925-i2c.c | 14 +-------------
> >  drivers/mfd/max8997.c     | 30 +++---------------------------
> >  drivers/mfd/max8998.c     | 27 +--------------------------
> >  7 files changed, 13 insertions(+), 155 deletions(-)
> > 
> 
> -- 
> 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] 20+ messages in thread

* Re: [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular
  2016-04-04 13:51   ` Paul Gortmaker
@ 2016-04-04 14:21     ` Lee Jones
  0 siblings, 0 replies; 20+ messages in thread
From: Lee Jones @ 2016-04-04 14:21 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Chanwoo Choi, Haojian Zhuang, Krzysztof Kozlowski,
	Kyungmin Park, MyungJoo Ham, Samuel Ortiz

On Mon, 04 Apr 2016, Paul Gortmaker wrote:

> [Re: [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular] On 04/04/2016 (Mon 09:11) Lee Jones wrote:
> 
> > How did you come up with the subject lines for these patches?
> 
> I just used the general default of:
>    <path_to_subsystem>: rest of subject
> 
> > 
> > Please do `git log --oneline -- <subsystem>`, as is normal when
> > submitting to mainline.
> 
> Just to be clear, looking at other mfd history, you want me to just
> drop the "drivers/" prefix ; i.e. change from:
> 
>    drivers/mfd: text text text driver.c text
> 
> ...to:
> 
>    mfd: text text text driver.c text
> 
> If so, that is no problem and I can do that for the next revision when I
> drop the patches pending tristate conversion that I wasn't aware of.

Current subsystem format is:

 mfd: sub-driver-name: Thing you're doing

Sub-driver-name doesn't require file extensions and 'Think that you're
doing" should start with an uppercase character.

(Royal-)We like straight lines and conformity. ;)

-- 
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] 20+ messages in thread

* Re: [PATCH 5/7] drivers/mfd: make max77686.c explicitly non-modular
  2016-04-04  3:44   ` Krzysztof Kozlowski
@ 2016-04-04 15:08     ` Paul Gortmaker
  2016-04-04 15:21     ` Javier Martinez Canillas
  1 sibling, 0 replies; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-04 15:08 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: linux-kernel, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Javier Martinez Canillas

[Re: [PATCH 5/7] drivers/mfd: make max77686.c explicitly non-modular] On 04/04/2016 (Mon 12:44) Krzysztof Kozlowski wrote:

> On 04.04.2016 06:24, Paul Gortmaker wrote:
> > The Kconfig currently controlling compilation of this code is:
> > 
> > drivers/mfd/Kconfig:config MFD_MAX77686
> > drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX77686/802 PMIC Support"
> > 
> > ...meaning that it currently is not being built as a module by anyone.
> > 

[...]

> > ---
> >  drivers/mfd/max77686.c | 26 ++------------------------
> >  1 file changed, 2 insertions(+), 24 deletions(-)
> 
> +Cc Javier,
> 
> I think we want to proceed with Javier's work for max77686:
> mfd: max77686: Allow the driver to be built as a module
> http://lkml.iu.edu/hypermail/linux/kernel/1602.1/03921.html

Not a problem ; I'll shelf this patch and assume it will make
the move to tristate.  Thanks for the heads up on the conversion
in progress.

Paul.
--

> 
> Javier, what is the status of your patchset? What do you need?
> 
> Best regards,
> Krzysztof

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

* Re: [PATCH 4/7] drivers/mfd: make max14577.c explicitly non-modular
  2016-04-04  3:42   ` Krzysztof Kozlowski
@ 2016-04-04 15:09     ` Paul Gortmaker
  2016-04-05 14:24     ` Javier Martinez Canillas
  1 sibling, 0 replies; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-04 15:09 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: linux-kernel, Chanwoo Choi, Samuel Ortiz, Lee Jones,
	Javier Martinez Canillas

[Re: [PATCH 4/7] drivers/mfd: make max14577.c explicitly non-modular] On 04/04/2016 (Mon 12:42) Krzysztof Kozlowski wrote:

> On 04.04.2016 06:24, Paul Gortmaker wrote:
> > The Kconfig currently controlling compilation of this code is:
> > 
> > mfd/Kconfig:config MFD_MAX14577
> > mfd/Kconfig:   bool "Maxim Semiconductor MAX14577/77836 MUIC + Charger Support"
> > 
> > ...meaning that it currently is not being built as a module by anyone.

[...]

> > ---
> >  drivers/mfd/max14577.c | 13 +------------
> >  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> +Cc Javier,
> 
> In general I agree with the patchset except maybe here because it
> conflicts with Javier's work to make it a module:
> mfd: max14577: Use module_init() instead of subsys_initcall()
> http://www.spinics.net/lists/kernel/msg2213747.html

No problem, I'll shelf this one as well and assume it is on the
way to being tristate.

Thanks,
Paul.
--

> 
> Javier's patchset is however missing a tested-by tag so maybe this is
> why it was not merged.
> 
> Unfortunately I cannot provide testing because my current device with
> max14577/max77836 is dead and its recovery is not easy. Maybe I will get
> a proper device in a few weeks after going back to Poland.
> 
> My proposal would be to wait with this max14577 change a little bit.
> 
> Best regards,
> Krzysztof

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

* Re: [PATCH 5/7] drivers/mfd: make max77686.c explicitly non-modular
  2016-04-04  3:44   ` Krzysztof Kozlowski
  2016-04-04 15:08     ` Paul Gortmaker
@ 2016-04-04 15:21     ` Javier Martinez Canillas
  1 sibling, 0 replies; 20+ messages in thread
From: Javier Martinez Canillas @ 2016-04-04 15:21 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Paul Gortmaker, linux-kernel
  Cc: Chanwoo Choi, Samuel Ortiz, Lee Jones

Hello Krzysztof,

On 04/03/2016 11:44 PM, Krzysztof Kozlowski wrote:
> On 04.04.2016 06:24, Paul Gortmaker wrote:
>> The Kconfig currently controlling compilation of this code is:
>>
>> drivers/mfd/Kconfig:config MFD_MAX77686
>> drivers/mfd/Kconfig:    bool "Maxim Semiconductor MAX77686/802 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: Chanwoo Choi <cw00.choi@samsung.com>
>> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>> 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/max77686.c | 26 ++------------------------
>>  1 file changed, 2 insertions(+), 24 deletions(-)
> 
> +Cc Javier,
> 
> I think we want to proceed with Javier's work for max77686:
> mfd: max77686: Allow the driver to be built as a module
> http://lkml.iu.edu/hypermail/linux/kernel/1602.1/03921.html
> 
> Javier, what is the status of your patchset? What do you need?
>

All patches but the one getting rid of the subsys initcall were
already picked by Lee.

I was waiting for the exynos thermal [0] patch that adds probe
deferral support to land into mainline to resend that one. The
patch is already in mainline so I'll do it today after testing.
 
> Best regards,
> Krzysztof
> 

[0]: https://lkml.org/lkml/2016/2/18/592

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

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

* Re: [PATCH 6/7] drivers/mfd: make max77693.c explicitly non-modular
  2016-04-04  3:53   ` Krzysztof Kozlowski
@ 2016-04-04 15:39     ` Paul Gortmaker
  2016-04-05  2:06       ` Krzysztof Kozlowski
  0 siblings, 1 reply; 20+ messages in thread
From: Paul Gortmaker @ 2016-04-04 15:39 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: linux-kernel, Chanwoo Choi, Samuel Ortiz, Lee Jones

[Re: [PATCH 6/7] drivers/mfd: make max77693.c explicitly non-modular] On 04/04/2016 (Mon 12:53) Krzysztof Kozlowski wrote:

> On 04.04.2016 06:24, Paul Gortmaker wrote:

[...]

> > diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
> > index b83b7a7da1ae..4126a55269d2 100644
> > --- a/drivers/mfd/max77693.c
> > +++ b/drivers/mfd/max77693.c
> > @@ -2,7 +2,7 @@
> >   * max77693.c - mfd core driver for the MAX 77693
> >   *
> >   * Copyright (C) 2012 Samsung Electronics
> > - * SangYoung Son <hello.son@smasung.com>
> > + * SangYoung Son <hello.son@samsung.com>
> >   *
> 
> That's good change.

Do you wan't to simply fold the typo fix into your patch?  I don't need
to carry a trivial change like that as a separate patch, nor does it
warrant a "Reported-by" or anything like that.

Paul.
--

> 
> As for the rest, I think the driver can be switch to module. Consumer
> (phy-samsung-usb2) support deferred probing. I can prepare and test a
> patch for that.
> 
> Best regards,
> Krzysztof
> 
> >   * This program is not provided / owned by Maxim Integrated Products.
> >   *
> > @@ -23,7 +23,7 @@
> >   * This driver is based on max8997.c
> >   */
> >  
> > -#include <linux/module.h>
> > +#include <linux/init.h>
> >  #include <linux/slab.h>
> >  #include <linux/i2c.h>
> >  #include <linux/err.h>
> > @@ -309,28 +309,10 @@ err_i2c_haptic:
> >  	return ret;
> >  }
> >  
> > -static int max77693_i2c_remove(struct i2c_client *i2c)
> > -{
> > -	struct max77693_dev *max77693 = i2c_get_clientdata(i2c);
> > -
> > -	mfd_remove_devices(max77693->dev);
> > -
> > -	regmap_del_irq_chip(max77693->irq, max77693->irq_data_muic);
> > -	regmap_del_irq_chip(max77693->irq, max77693->irq_data_chg);
> > -	regmap_del_irq_chip(max77693->irq, max77693->irq_data_topsys);
> > -	regmap_del_irq_chip(max77693->irq, max77693->irq_data_led);
> > -
> > -	i2c_unregister_device(max77693->i2c_muic);
> > -	i2c_unregister_device(max77693->i2c_haptic);
> > -
> > -	return 0;
> > -}
> > -
> >  static const struct i2c_device_id max77693_i2c_id[] = {
> >  	{ "max77693", TYPE_MAX77693 },
> >  	{ }
> >  };
> > -MODULE_DEVICE_TABLE(i2c, max77693_i2c_id);
> >  
> >  static int max77693_suspend(struct device *dev)
> >  {
> > @@ -374,10 +356,10 @@ static struct i2c_driver max77693_i2c_driver = {
> >  	.driver = {
> >  		   .name = "max77693",
> >  		   .pm = &max77693_pm,
> > +		   .suppress_bind_attrs = true,
> >  		   .of_match_table = of_match_ptr(max77693_dt_match),
> >  	},
> >  	.probe = max77693_i2c_probe,
> > -	.remove = max77693_i2c_remove,
> >  	.id_table = max77693_i2c_id,
> >  };
> >  
> > @@ -387,13 +369,3 @@ static int __init max77693_i2c_init(void)
> >  }
> >  /* init early so consumer devices can complete system boot */
> >  subsys_initcall(max77693_i2c_init);
> > -
> > -static void __exit max77693_i2c_exit(void)
> > -{
> > -	i2c_del_driver(&max77693_i2c_driver);
> > -}
> > -module_exit(max77693_i2c_exit);
> > -
> > -MODULE_DESCRIPTION("MAXIM 77693 multi-function core driver");
> > -MODULE_AUTHOR("SangYoung, Son <hello.son@samsung.com>");
> > -MODULE_LICENSE("GPL");
> > 
> 

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

* Re: [PATCH 6/7] drivers/mfd: make max77693.c explicitly non-modular
  2016-04-04 15:39     ` Paul Gortmaker
@ 2016-04-05  2:06       ` Krzysztof Kozlowski
  0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Kozlowski @ 2016-04-05  2:06 UTC (permalink / raw)
  To: Paul Gortmaker; +Cc: linux-kernel, Chanwoo Choi, Samuel Ortiz, Lee Jones

On 05.04.2016 00:39, Paul Gortmaker wrote:
> [Re: [PATCH 6/7] drivers/mfd: make max77693.c explicitly non-modular] On 04/04/2016 (Mon 12:53) Krzysztof Kozlowski wrote:
> 
>> On 04.04.2016 06:24, Paul Gortmaker wrote:
> 
> [...]
> 
>>> diff --git a/drivers/mfd/max77693.c b/drivers/mfd/max77693.c
>>> index b83b7a7da1ae..4126a55269d2 100644
>>> --- a/drivers/mfd/max77693.c
>>> +++ b/drivers/mfd/max77693.c
>>> @@ -2,7 +2,7 @@
>>>   * max77693.c - mfd core driver for the MAX 77693
>>>   *
>>>   * Copyright (C) 2012 Samsung Electronics
>>> - * SangYoung Son <hello.son@smasung.com>
>>> + * SangYoung Son <hello.son@samsung.com>
>>>   *
>>
>> That's good change.
> 
> Do you wan't to simply fold the typo fix into your patch?  I don't need
> to carry a trivial change like that as a separate patch, nor does it
> warrant a "Reported-by" or anything like that.

Ok, I will handle this fix. Thanks!

Best regards,
Krzysztof

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

* Re: [PATCH 4/7] drivers/mfd: make max14577.c explicitly non-modular
  2016-04-04  3:42   ` Krzysztof Kozlowski
  2016-04-04 15:09     ` Paul Gortmaker
@ 2016-04-05 14:24     ` Javier Martinez Canillas
  1 sibling, 0 replies; 20+ messages in thread
From: Javier Martinez Canillas @ 2016-04-05 14:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Paul Gortmaker, linux-kernel
  Cc: Chanwoo Choi, Samuel Ortiz, Lee Jones

Hello Krzysztof,

On 04/03/2016 11:42 PM, Krzysztof Kozlowski wrote:
> On 04.04.2016 06:24, Paul Gortmaker wrote:
>> The Kconfig currently controlling compilation of this code is:
>>
>> mfd/Kconfig:config MFD_MAX14577
>> mfd/Kconfig:   bool "Maxim Semiconductor MAX14577/77836 MUIC + Charger 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: Chanwoo Choi <cw00.choi@samsung.com>
>> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
>> 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/max14577.c | 13 +------------
>>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> +Cc Javier,
> 
> In general I agree with the patchset except maybe here because it
> conflicts with Javier's work to make it a module:
> mfd: max14577: Use module_init() instead of subsys_initcall()
> http://www.spinics.net/lists/kernel/msg2213747.html
> 
> Javier's patchset is however missing a tested-by tag so maybe this is
> why it was not merged.
> 
> Unfortunately I cannot provide testing because my current device with
> max14577/max77836 is dead and its recovery is not easy. Maybe I will get
> a proper device in a few weeks after going back to Poland.
> 
> My proposal would be to wait with this max14577 change a little bit.
> 

Chanwoo said he should be able to test: https://lkml.org/lkml/2016/3/18/78
So hopefully I should have some Tested-by tags for that series soon.

> Best regards,
> Krzysztof
> 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

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

end of thread, other threads:[~2016-04-05 14:24 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-03 21:24 [PATCH 0/7] drivers/mfd: make max drivers explicitly non-modular Paul Gortmaker
2016-04-03 21:24 ` [PATCH 1/7] drivers/mfd: make max8925-i2c.c " Paul Gortmaker
2016-04-03 21:24 ` [PATCH 2/7] drivers/mfd: make max8997.c " Paul Gortmaker
2016-04-03 21:24 ` [PATCH 3/7] drivers/mfd: make max8998.c " Paul Gortmaker
2016-04-03 21:24 ` [PATCH 4/7] drivers/mfd: make max14577.c " Paul Gortmaker
2016-04-04  3:42   ` Krzysztof Kozlowski
2016-04-04 15:09     ` Paul Gortmaker
2016-04-05 14:24     ` Javier Martinez Canillas
2016-04-03 21:24 ` [PATCH 5/7] drivers/mfd: make max77686.c " Paul Gortmaker
2016-04-04  3:44   ` Krzysztof Kozlowski
2016-04-04 15:08     ` Paul Gortmaker
2016-04-04 15:21     ` Javier Martinez Canillas
2016-04-03 21:24 ` [PATCH 6/7] drivers/mfd: make max77693.c " Paul Gortmaker
2016-04-04  3:53   ` Krzysztof Kozlowski
2016-04-04 15:39     ` Paul Gortmaker
2016-04-05  2:06       ` Krzysztof Kozlowski
2016-04-03 21:24 ` [PATCH 7/7] drivers/mfd: make max77843.c " Paul Gortmaker
2016-04-04  8:11 ` [PATCH 0/7] drivers/mfd: make max drivers " Lee Jones
2016-04-04 13:51   ` Paul Gortmaker
2016-04-04 14:21     ` 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).