Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1412653 > unrolled thread
| Started by | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| First post | 2016-06-03 02:50 +0200 |
| Last post | 2016-06-03 02:50 +0200 |
| Articles | 3 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 0/5] mfd: Make max drivers explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-06-03 02:50 +0200
[PATCH 5/5] mfd: max77843: Make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-06-03 02:50 +0200
[PATCH 1/5] mfd: max8925-i2c: Make it explicitly non-modular Paul Gortmaker <paul.gortmaker@windriver.com> - 2016-06-03 02:50 +0200
| From | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| Date | 2016-06-03 02:50 +0200 |
| Subject | [PATCH v2 0/5] mfd: Make max drivers explicitly non-modular |
| Message-ID | <rFLtf-4E1-3@gated-at.bofh.it> |
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
[toc] | [next] | [standalone]
| From | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| Date | 2016-06-03 02:50 +0200 |
| Subject | [PATCH 5/5] mfd: max77843: Make it explicitly non-modular |
| Message-ID | <rFLtg-4E1-11@gated-at.bofh.it> |
| In reply to | #1412653 |
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
[toc] | [prev] | [next] | [standalone]
| From | Paul Gortmaker <paul.gortmaker@windriver.com> |
|---|---|
| Date | 2016-06-03 02:50 +0200 |
| Subject | [PATCH 1/5] mfd: max8925-i2c: Make it explicitly non-modular |
| Message-ID | <rFLtg-4E1-21@gated-at.bofh.it> |
| In reply to | #1412653 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web