* [PATCH 3/5] PM / devfreq: make exynos-bus explicitly non-modular
2016-06-21 5:14 ` [PATCH 0/5] PM / devfreq: remove modular references from non-modules Paul Gortmaker
@ 2016-06-21 5:14 ` Paul Gortmaker
2016-06-21 5:15 ` [PATCH 4/5] PM / devfreq: make event/exynos-nocp " Paul Gortmaker
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2016-06-21 5:14 UTC (permalink / raw)
To: linux-kernel
Cc: Paul Gortmaker, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Kukjin Kim, Krzysztof Kozlowski, linux-pm, linux-samsung-soc
The Kconfig currently controlling compilation of this code is:
devfreq/Kconfig:config ARM_EXYNOS_BUS_DEVFREQ
devfreq/Kconfig: bool "ARM EXYNOS Generic Memory Bus DEVFREQ Driver"
...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_platform_driver() uses the same init level priority as
builtin_platform_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
is already contained at the top of the file in the comments.
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/devfreq/exynos-bus.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c
index 2363d0a189b7..2e018d80e0f7 100644
--- a/drivers/devfreq/exynos-bus.c
+++ b/drivers/devfreq/exynos-bus.c
@@ -17,7 +17,7 @@
#include <linux/devfreq-event.h>
#include <linux/device.h>
#include <linux/export.h>
-#include <linux/module.h>
+#include <linux/init.h>
#include <linux/of_device.h>
#include <linux/pm_opp.h>
#include <linux/platform_device.h>
@@ -553,7 +553,6 @@ static const struct of_device_id exynos_bus_of_match[] = {
{ .compatible = "samsung,exynos-bus", },
{ /* sentinel */ },
};
-MODULE_DEVICE_TABLE(of, exynos_bus_of_match);
static struct platform_driver exynos_bus_platdrv = {
.probe = exynos_bus_probe,
@@ -563,8 +562,4 @@ static struct platform_driver exynos_bus_platdrv = {
.of_match_table = of_match_ptr(exynos_bus_of_match),
},
};
-module_platform_driver(exynos_bus_platdrv);
-
-MODULE_DESCRIPTION("Generic Exynos Bus frequency driver");
-MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>");
-MODULE_LICENSE("GPL v2");
+builtin_platform_driver(exynos_bus_platdrv);
--
2.8.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 4/5] PM / devfreq: make event/exynos-nocp explicitly non-modular
2016-06-21 5:14 ` [PATCH 0/5] PM / devfreq: remove modular references from non-modules Paul Gortmaker
2016-06-21 5:14 ` [PATCH 3/5] PM / devfreq: make exynos-bus explicitly non-modular Paul Gortmaker
@ 2016-06-21 5:15 ` Paul Gortmaker
2016-06-21 5:15 ` [PATCH 5/5] PM / devfreq: make event/exynos-ppmu " Paul Gortmaker
2016-06-21 6:17 ` [PATCH 0/5] PM / devfreq: remove modular references from non-modules Chanwoo Choi
3 siblings, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2016-06-21 5:15 UTC (permalink / raw)
To: linux-kernel
Cc: Paul Gortmaker, Chanwoo Choi, MyungJoo Ham, Kyungmin Park,
Kukjin Kim, Krzysztof Kozlowski, linux-pm, linux-samsung-soc
The Kconfig currently controlling compilation of this code is:
event/Kconfig:config DEVFREQ_EVENT_EXYNOS_NOCP
event/Kconfig: bool "EXYNOS NoC (Network On Chip) Probe DEVFREQ event Driver"
...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_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.
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: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/devfreq/event/exynos-nocp.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/devfreq/event/exynos-nocp.c b/drivers/devfreq/event/exynos-nocp.c
index 6b6a5f310486..f954578abfdf 100644
--- a/drivers/devfreq/event/exynos-nocp.c
+++ b/drivers/devfreq/event/exynos-nocp.c
@@ -10,7 +10,7 @@
*/
#include <linux/clk.h>
-#include <linux/module.h>
+#include <linux/init.h>
#include <linux/devfreq-event.h>
#include <linux/kernel.h>
#include <linux/of_address.h>
@@ -280,25 +280,12 @@ static int exynos_nocp_probe(struct platform_device *pdev)
return 0;
}
-static int exynos_nocp_remove(struct platform_device *pdev)
-{
- struct exynos_nocp *nocp = platform_get_drvdata(pdev);
-
- clk_disable_unprepare(nocp->clk);
-
- return 0;
-}
-
static struct platform_driver exynos_nocp_driver = {
.probe = exynos_nocp_probe,
- .remove = exynos_nocp_remove,
.driver = {
.name = "exynos-nocp",
+ .suppress_bind_attrs = true,
.of_match_table = exynos_nocp_id_match,
},
};
-module_platform_driver(exynos_nocp_driver);
-
-MODULE_DESCRIPTION("Exynos NoC (Network on Chip) Probe driver");
-MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(exynos_nocp_driver);
--
2.8.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 5/5] PM / devfreq: make event/exynos-ppmu explicitly non-modular
2016-06-21 5:14 ` [PATCH 0/5] PM / devfreq: remove modular references from non-modules Paul Gortmaker
2016-06-21 5:14 ` [PATCH 3/5] PM / devfreq: make exynos-bus explicitly non-modular Paul Gortmaker
2016-06-21 5:15 ` [PATCH 4/5] PM / devfreq: make event/exynos-nocp " Paul Gortmaker
@ 2016-06-21 5:15 ` Paul Gortmaker
2016-06-21 6:17 ` [PATCH 0/5] PM / devfreq: remove modular references from non-modules Chanwoo Choi
3 siblings, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2016-06-21 5:15 UTC (permalink / raw)
To: linux-kernel
Cc: Paul Gortmaker, MyungJoo Ham, Kyungmin Park, Kukjin Kim,
Krzysztof Kozlowski, Chanwoo Choi, linux-pm, linux-samsung-soc
The Kconfig currently controlling compilation of this code is:
config DEVFREQ_EVENT_EXYNOS_PPMU
bool "EXYNOS PPMU (Platform Perf Monitoring Unit) DEVFREQ event Driver"
...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_platform_driver() uses the same init level priority as
builtin_platform_driver() the init ordering remains unchanged with
this commit.
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: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
drivers/devfreq/event/exynos-ppmu.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/devfreq/event/exynos-ppmu.c b/drivers/devfreq/event/exynos-ppmu.c
index f312485f1451..38a997807043 100644
--- a/drivers/devfreq/event/exynos-ppmu.c
+++ b/drivers/devfreq/event/exynos-ppmu.c
@@ -14,7 +14,7 @@
#include <linux/clk.h>
#include <linux/io.h>
#include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
#include <linux/mutex.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>
@@ -524,8 +524,4 @@ static struct platform_driver exynos_ppmu_driver = {
.of_match_table = exynos_ppmu_id_match,
},
};
-module_platform_driver(exynos_ppmu_driver);
-
-MODULE_DESCRIPTION("Exynos PPMU(Platform Performance Monitoring Unit) driver");
-MODULE_AUTHOR("Chanwoo Choi <cw00.choi@samsung.com>");
-MODULE_LICENSE("GPL");
+builtin_platform_driver(exynos_ppmu_driver);
--
2.8.4
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/5] PM / devfreq: remove modular references from non-modules
2016-06-21 5:14 ` [PATCH 0/5] PM / devfreq: remove modular references from non-modules Paul Gortmaker
` (2 preceding siblings ...)
2016-06-21 5:15 ` [PATCH 5/5] PM / devfreq: make event/exynos-ppmu " Paul Gortmaker
@ 2016-06-21 6:17 ` Chanwoo Choi
3 siblings, 0 replies; 5+ messages in thread
From: Chanwoo Choi @ 2016-06-21 6:17 UTC (permalink / raw)
To: Paul Gortmaker, linux-kernel
Cc: Krzysztof Kozlowski, Kukjin Kim, Kyungmin Park, MyungJoo Ham,
linux-pm, linux-samsung-soc
Hi Paul,
It is good for devfreq/devfreq-event framework(patch1/patch2).
But, I think that the device driver (patch3/4/5) should change
the type from 'bool' to 'tristate' instead of using the .
Thanks,
Chanwoo Choi
On 2016년 06월 21일 14:14, Paul Gortmaker wrote:
> For anyone new to the underlying goal of this cleanup, we are trying to
> not use module support for code that can never be built as a module since:
>
> (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 code and spreads like weeds.
>
> We have already merged over 100 of these for mainline to date, so there
> is really nothing new to see here, in terms of the type of change.
>
> That said, devfreq changes seen here cover the following categories:
>
> -just replacement of modular macros with their non-modular
> equivalents that CPP would have inserted anyway
>
> -the removal of including module.h ; replaced with init.h
> and/or export.h as required based on whether the file used it.
>
> -the removal of any/all unused/orphaned __exit functions that
> would never be called.
>
> -the removal of any ".remove" functions that were hooked into
> the driver struct. This ".remove" function would of
> course not be called from the __exit function since that was
> never run. However in theory, someone could have triggered it
> via sysfs unbind, even though there isn't a sensible use case
> for doing so. So to cover that possibility, we've also disabled
> sysfs unbind in the driver.
>
> There are no initcall level changes here; everything stays at the level
> of initcall it was previously - either by not using modular versions to
> begin with, or by using the builtin level equivalents.
>
> Build tested for arm and arm64 allmodconfig (for which all the drivers
> touched here get coverage) on the linux-next tree from today to ensure
> no silly typos crept in.
>
> If there is a desire for any of these to be modular, we can definitely
> consider that, but by default the changes here keep the code consistent
> with existing behaviour. Thus I do not expand functionality into the
> modular realm that I can't run time test, or even know if the modular
> instance has a sensible modular use case.
>
> Paul.
> ---
>
> Cc: Chanwoo Choi <cw00.choi@samsung.com>
> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> Cc: Kukjin Kim <kgene@kernel.org>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
> Cc: linux-pm@vger.kernel.org
> Cc: linux-samsung-soc@vger.kernel.org
>
>
> Paul Gortmaker (5):
> PM / devfreq: make devfreq explicitly non-modular
> PM / devfreq: make devfreq-event explicitly non-modular
> PM / devfreq: make exynos-bus explicitly non-modular
> PM / devfreq: make event/exynos-nocp explicitly non-modular
> PM / devfreq: make event/exynos-ppmu explicitly non-modular
>
> drivers/devfreq/devfreq-event.c | 12 +-----------
> drivers/devfreq/devfreq.c | 13 +------------
> drivers/devfreq/event/exynos-nocp.c | 19 +++----------------
> drivers/devfreq/event/exynos-ppmu.c | 8 ++------
> drivers/devfreq/exynos-bus.c | 9 ++-------
> 5 files changed, 9 insertions(+), 52 deletions(-)
>
^ permalink raw reply [flat|nested] 5+ messages in thread