linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] cpuidle: avoid module usage in non-modular code
@ 2015-12-13 23:57 Paul Gortmaker
  2015-12-13 23:57 ` [PATCH 1/3] drivers/cpuidle: make cpuidle-clps711x.c explicitly non-modular Paul Gortmaker
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Paul Gortmaker @ 2015-12-13 23:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Alexander Shiyan, Bartlomiej Zolnierkiewicz,
	Daniel Lezcano, Krzysztof Kozlowski, Kukjin Kim,
	Rafael J. Wysocki, linux-arm-kernel, linux-pm, linux-samsung-soc

This series of commits is a part of a larger project to ensure
people don't reference modular support functions in non-modular
code.  Overall there was roughly 5k lines of dead code in the
kernel due to this.  So far we've fixed several areas, like tty,
x86, net, ... and we continue to work on other areas.

There are several reasons to not use module support for code that
can never be built as a module, but the big ones are:

 (1) it is easy to accidentally code up 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.

Fortunately for cpuidle, the changes are largely trivial and change
zero runtime.  All the changes here just remap the modular functions
onto the non-modular ones that they would be remapped onto anyway.

Changes are against linux-next and compile tested on ARM allmodconfig.
I've Cc'd ARM list because all of these are used on ARM, but I'm
thinking these probably can go in via the PM tree.

Paul.
---

Cc: Alexander Shiyan <shc_work@mail.ru>
Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-pm@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org

Paul Gortmaker (3):
  drivers/cpuidle: make cpuidle-clps711x.c explicitly non-modular
  drivers/cpuidle: make cpuidle-ux500.c explicitly non-modular
  drivers/cpuidle: make cpuidle-exynos.c explicitly non-modular

 drivers/cpuidle/cpuidle-clps711x.c | 8 ++------
 drivers/cpuidle/cpuidle-exynos.c   | 5 ++---
 drivers/cpuidle/cpuidle-ux500.c    | 5 ++---
 3 files changed, 6 insertions(+), 12 deletions(-)

-- 
2.6.1

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

* [PATCH 1/3] drivers/cpuidle: make cpuidle-clps711x.c explicitly non-modular
  2015-12-13 23:57 [PATCH 0/3] cpuidle: avoid module usage in non-modular code Paul Gortmaker
@ 2015-12-13 23:57 ` Paul Gortmaker
  2015-12-13 23:57 ` [PATCH 2/3] drivers/cpuidle: make cpuidle-ux500.c " Paul Gortmaker
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Paul Gortmaker @ 2015-12-13 23:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Rafael J. Wysocki, Daniel Lezcano,
	Alexander Shiyan, linux-pm, linux-arm-kernel

The Kconfig currently controlling compilation of this code is:

drivers/cpuidle/Kconfig.arm:config ARM_CLPS711X_CPUIDLE
drivers/cpuidle/Kconfig.arm:    bool "CPU Idle Driver for CLPS711X processors"

...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: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Alexander Shiyan <shc_work@mail.ru>
Cc: linux-pm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/cpuidle/cpuidle-clps711x.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-clps711x.c b/drivers/cpuidle/cpuidle-clps711x.c
index 18a7f7380508..66a9f231ec41 100644
--- a/drivers/cpuidle/cpuidle-clps711x.c
+++ b/drivers/cpuidle/cpuidle-clps711x.c
@@ -12,7 +12,7 @@
 #include <linux/cpuidle.h>
 #include <linux/err.h>
 #include <linux/io.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 
 #define CLPS711X_CPUIDLE_NAME	"clps711x-cpuidle"
@@ -56,8 +56,4 @@ static struct platform_driver clps711x_cpuidle_driver = {
 		.name	= CLPS711X_CPUIDLE_NAME,
 	},
 };
-module_platform_driver_probe(clps711x_cpuidle_driver, clps711x_cpuidle_probe);
-
-MODULE_AUTHOR("Alexander Shiyan <shc_work@mail.ru>");
-MODULE_DESCRIPTION("CLPS711X CPU idle driver");
-MODULE_LICENSE("GPL");
+builtin_platform_driver_probe(clps711x_cpuidle_driver, clps711x_cpuidle_probe);
-- 
2.6.1

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

* [PATCH 2/3] drivers/cpuidle: make cpuidle-ux500.c explicitly non-modular
  2015-12-13 23:57 [PATCH 0/3] cpuidle: avoid module usage in non-modular code Paul Gortmaker
  2015-12-13 23:57 ` [PATCH 1/3] drivers/cpuidle: make cpuidle-clps711x.c explicitly non-modular Paul Gortmaker
@ 2015-12-13 23:57 ` Paul Gortmaker
  2015-12-13 23:57 ` [PATCH 3/3] drivers/cpuidle: make cpuidle-exynos.c " Paul Gortmaker
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Paul Gortmaker @ 2015-12-13 23:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Rafael J. Wysocki, Daniel Lezcano, linux-pm,
	linux-arm-kernel

The Kconfig currently controlling compilation of this code is:

cpuidle/Kconfig.arm:config ARM_U8500_CPUIDLE
cpuidle/Kconfig.arm:    bool "Cpu Idle Driver for the ST-E u8500 processors"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modularity 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.

Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: linux-pm@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/cpuidle/cpuidle-ux500.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-ux500.c b/drivers/cpuidle/cpuidle-ux500.c
index 8bf895c0017d..7941a090bea6 100644
--- a/drivers/cpuidle/cpuidle-ux500.c
+++ b/drivers/cpuidle/cpuidle-ux500.c
@@ -9,7 +9,7 @@
  * published by the Free Software Foundation.
  */
 
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/cpuidle.h>
 #include <linux/spinlock.h>
 #include <linux/atomic.h>
@@ -124,5 +124,4 @@ static struct platform_driver dbx500_cpuidle_plat_driver = {
 	},
 	.probe = dbx500_cpuidle_probe,
 };
-
-module_platform_driver(dbx500_cpuidle_plat_driver);
+builtin_platform_driver(dbx500_cpuidle_plat_driver);
-- 
2.6.1

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

* [PATCH 3/3] drivers/cpuidle: make cpuidle-exynos.c explicitly non-modular
  2015-12-13 23:57 [PATCH 0/3] cpuidle: avoid module usage in non-modular code Paul Gortmaker
  2015-12-13 23:57 ` [PATCH 1/3] drivers/cpuidle: make cpuidle-clps711x.c explicitly non-modular Paul Gortmaker
  2015-12-13 23:57 ` [PATCH 2/3] drivers/cpuidle: make cpuidle-ux500.c " Paul Gortmaker
@ 2015-12-13 23:57 ` Paul Gortmaker
  2015-12-14 21:17 ` [PATCH 0/3] cpuidle: avoid module usage in non-modular code Daniel Lezcano
  2015-12-14 21:31 ` Rafael J. Wysocki
  4 siblings, 0 replies; 7+ messages in thread
From: Paul Gortmaker @ 2015-12-13 23:57 UTC (permalink / raw)
  To: linux-kernel
  Cc: Krzysztof Kozlowski, linux-samsung-soc, Bartlomiej Zolnierkiewicz,
	linux-pm, Daniel Lezcano, Rafael J. Wysocki, Paul Gortmaker,
	Kukjin Kim, linux-arm-kernel

The Kconfig currently controlling compilation of this code is:

cpuidle/Kconfig.arm:config ARM_EXYNOS_CPUIDLE
cpuidle/Kconfig.arm:    bool "Cpu Idle Driver for the Exynos processors"

...meaning that it currently is not being built as a module by anyone.

Lets remove the couple traces of modularity 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.

Cc: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 drivers/cpuidle/cpuidle-exynos.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/cpuidle/cpuidle-exynos.c b/drivers/cpuidle/cpuidle-exynos.c
index b5f0a9cc8185..00cd129b10a4 100644
--- a/drivers/cpuidle/cpuidle-exynos.c
+++ b/drivers/cpuidle/cpuidle-exynos.c
@@ -14,7 +14,7 @@
 #include <linux/cpuidle.h>
 #include <linux/cpu_pm.h>
 #include <linux/export.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
 #include <linux/platform_data/cpuidle-exynos.h>
@@ -142,5 +142,4 @@ static struct platform_driver exynos_cpuidle_driver = {
 		.name = "exynos_cpuidle",
 	},
 };
-
-module_platform_driver(exynos_cpuidle_driver);
+builtin_platform_driver(exynos_cpuidle_driver);
-- 
2.6.1

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

* Re: [PATCH 0/3] cpuidle: avoid module usage in non-modular code
  2015-12-13 23:57 [PATCH 0/3] cpuidle: avoid module usage in non-modular code Paul Gortmaker
                   ` (2 preceding siblings ...)
  2015-12-13 23:57 ` [PATCH 3/3] drivers/cpuidle: make cpuidle-exynos.c " Paul Gortmaker
@ 2015-12-14 21:17 ` Daniel Lezcano
  2015-12-14 21:31 ` Rafael J. Wysocki
  4 siblings, 0 replies; 7+ messages in thread
From: Daniel Lezcano @ 2015-12-14 21:17 UTC (permalink / raw)
  To: Paul Gortmaker, linux-kernel
  Cc: Alexander Shiyan, Bartlomiej Zolnierkiewicz, Krzysztof Kozlowski,
	Kukjin Kim, Rafael J. Wysocki, linux-arm-kernel, linux-pm,
	linux-samsung-soc

On 12/14/2015 12:57 AM, Paul Gortmaker wrote:
> This series of commits is a part of a larger project to ensure
> people don't reference modular support functions in non-modular
> code.  Overall there was roughly 5k lines of dead code in the
> kernel due to this.  So far we've fixed several areas, like tty,
> x86, net, ... and we continue to work on other areas.
>
> There are several reasons to not use module support for code that
> can never be built as a module, but the big ones are:
>
>   (1) it is easy to accidentally code up 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.
>
> Fortunately for cpuidle, the changes are largely trivial and change
> zero runtime.  All the changes here just remap the modular functions
> onto the non-modular ones that they would be remapped onto anyway.
>
> Changes are against linux-next and compile tested on ARM allmodconfig.
> I've Cc'd ARM list because all of these are used on ARM, but I'm
> thinking these probably can go in via the PM tree.

Acked-by: Daniel Lezcano <daniel.lezcano@linaro.org>


-- 
  <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


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

* Re: [PATCH 0/3] cpuidle: avoid module usage in non-modular code
  2015-12-13 23:57 [PATCH 0/3] cpuidle: avoid module usage in non-modular code Paul Gortmaker
                   ` (3 preceding siblings ...)
  2015-12-14 21:17 ` [PATCH 0/3] cpuidle: avoid module usage in non-modular code Daniel Lezcano
@ 2015-12-14 21:31 ` Rafael J. Wysocki
  2015-12-14 21:32   ` Paul Gortmaker
  4 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2015-12-14 21:31 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel, Alexander Shiyan, Bartlomiej Zolnierkiewicz,
	Daniel Lezcano, Krzysztof Kozlowski, Kukjin Kim, linux-arm-kernel,
	linux-pm, linux-samsung-soc

On Sunday, December 13, 2015 06:57:09 PM Paul Gortmaker wrote:
> This series of commits is a part of a larger project to ensure
> people don't reference modular support functions in non-modular
> code.  Overall there was roughly 5k lines of dead code in the
> kernel due to this.  So far we've fixed several areas, like tty,
> x86, net, ... and we continue to work on other areas.
> 
> There are several reasons to not use module support for code that
> can never be built as a module, but the big ones are:
> 
>  (1) it is easy to accidentally code up 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.
> 
> Fortunately for cpuidle, the changes are largely trivial and change
> zero runtime.  All the changes here just remap the modular functions
> onto the non-modular ones that they would be remapped onto anyway.
> 
> Changes are against linux-next and compile tested on ARM allmodconfig.
> I've Cc'd ARM list because all of these are used on ARM, but I'm
> thinking these probably can go in via the PM tree.

If no one objects, I can queue up this series for 4.5 unless you have other
plans with respect to it.

Thanks,
Rafael


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

* Re: [PATCH 0/3] cpuidle: avoid module usage in non-modular code
  2015-12-14 21:31 ` Rafael J. Wysocki
@ 2015-12-14 21:32   ` Paul Gortmaker
  0 siblings, 0 replies; 7+ messages in thread
From: Paul Gortmaker @ 2015-12-14 21:32 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: linux-kernel, Alexander Shiyan, Bartlomiej Zolnierkiewicz,
	Daniel Lezcano, Krzysztof Kozlowski, Kukjin Kim, linux-arm-kernel,
	linux-pm, linux-samsung-soc

[Re: [PATCH 0/3] cpuidle: avoid module usage in non-modular code] On 14/12/2015 (Mon 22:31) Rafael J. Wysocki wrote:

> On Sunday, December 13, 2015 06:57:09 PM Paul Gortmaker wrote:
> > This series of commits is a part of a larger project to ensure
> > people don't reference modular support functions in non-modular
> > code.  Overall there was roughly 5k lines of dead code in the
> > kernel due to this.  So far we've fixed several areas, like tty,
> > x86, net, ... and we continue to work on other areas.

[...]

> 
> If no one objects, I can queue up this series for 4.5 unless you have other
> plans with respect to it.

Please do.

I was hoping to spread as many of these around as possible so I don't
end up with a giant pull request to Linus.  There is code out there
without a clear maintainership path, so eventually I'll have to send
some his way (or via akpm) but the less that end up in that pile, the
better IMHO.

Thanks,
Paul.
--
> 
> Thanks,
> Rafael
> 

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

end of thread, other threads:[~2015-12-14 21:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-13 23:57 [PATCH 0/3] cpuidle: avoid module usage in non-modular code Paul Gortmaker
2015-12-13 23:57 ` [PATCH 1/3] drivers/cpuidle: make cpuidle-clps711x.c explicitly non-modular Paul Gortmaker
2015-12-13 23:57 ` [PATCH 2/3] drivers/cpuidle: make cpuidle-ux500.c " Paul Gortmaker
2015-12-13 23:57 ` [PATCH 3/3] drivers/cpuidle: make cpuidle-exynos.c " Paul Gortmaker
2015-12-14 21:17 ` [PATCH 0/3] cpuidle: avoid module usage in non-modular code Daniel Lezcano
2015-12-14 21:31 ` Rafael J. Wysocki
2015-12-14 21:32   ` Paul Gortmaker

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