linux-tegra.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] soc: avoid module usage in non-modular code
@ 2016-11-13 19:02 Paul Gortmaker
       [not found] ` <20161113190302.18099-1-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Gortmaker @ 2016-11-13 19:02 UTC (permalink / raw)
  To: linux-kernel
  Cc: Paul Gortmaker, Alexandre Courbot, Arnd Bergmann, Maxime Ripard,
	Scott Wood, Stephen Warren, Thierry Reding, Ulf Hansson,
	Yangbo Lu, linux-arm-kernel, linuxppc-dev, linux-tegra

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, gpio ... 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.

Two of the changes are essentially source only -- the resuting module
will be binary equivalent.  Only the FSL driver has unused code in
addition to the use of modular macros that get converted.

Note the FSL SOC driver just appeared in linux-next and so this series
won't apply on Linus' master branch.  These commits were applied to
linux-next and build tested there.

Paul.
---

Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Scott Wood <oss@buserror.net>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Yangbo Lu <yangbo.lu@nxp.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-tegra@vger.kernel.org

Paul Gortmaker (3):
  soc: sunxi: make sunxi_sram explicitly non-modular
  soc: tegra: make fuse-tegra explicitly non-modular
  soc: fsl: make guts driver explicitly non-modular

 drivers/soc/fsl/guts.c              | 17 ++---------------
 drivers/soc/sunxi/sunxi_sram.c      |  9 ++-------
 drivers/soc/tegra/fuse/fuse-tegra.c |  4 ++--
 3 files changed, 6 insertions(+), 24 deletions(-)

-- 
2.10.1

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

* [PATCH 2/3] soc: tegra: make fuse-tegra explicitly non-modular
       [not found] ` <20161113190302.18099-1-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
@ 2016-11-13 19:03   ` Paul Gortmaker
       [not found]     ` <20161113190302.18099-3-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Gortmaker @ 2016-11-13 19:03 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Paul Gortmaker, Stephen Warren, Thierry Reding, Alexandre Courbot,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

The Makefiles currently controlling compilation of this code is:

drivers/soc/tegra/Makefile:obj-y += fuse/
drivers/soc/tegra/fuse/Makefile:obj-y += fuse-tegra.o

...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: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Paul Gortmaker <paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
---
 drivers/soc/tegra/fuse/fuse-tegra.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index de2c1bfe28b5..7413f60fa855 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -18,7 +18,7 @@
 #include <linux/clk.h>
 #include <linux/device.h>
 #include <linux/kobject.h>
-#include <linux/module.h>
+#include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/of.h>
 #include <linux/of_address.h>
@@ -168,7 +168,7 @@ static struct platform_driver tegra_fuse_driver = {
 	},
 	.probe = tegra_fuse_probe,
 };
-module_platform_driver(tegra_fuse_driver);
+builtin_platform_driver(tegra_fuse_driver);
 
 bool __init tegra_fuse_read_spare(unsigned int spare)
 {
-- 
2.10.1

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

* Re: [PATCH 2/3] soc: tegra: make fuse-tegra explicitly non-modular
       [not found]     ` <20161113190302.18099-3-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
@ 2017-04-04 13:25       ` Thierry Reding
  0 siblings, 0 replies; 3+ messages in thread
From: Thierry Reding @ 2017-04-04 13:25 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA, Stephen Warren,
	Alexandre Courbot, linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1135 bytes --]

On Sun, Nov 13, 2016 at 02:03:01PM -0500, Paul Gortmaker wrote:
> The Makefiles currently controlling compilation of this code is:
> 
> drivers/soc/tegra/Makefile:obj-y += fuse/
> drivers/soc/tegra/fuse/Makefile:obj-y += fuse-tegra.o
> 
> ...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: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
> Cc: Thierry Reding <thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: Alexandre Courbot <gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Cc: linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
> ---
>  drivers/soc/tegra/fuse/fuse-tegra.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied to for-4.12/soc, thanks.

Thierry

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2017-04-04 13:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-13 19:02 [PATCH 0/3] soc: avoid module usage in non-modular code Paul Gortmaker
     [not found] ` <20161113190302.18099-1-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2016-11-13 19:03   ` [PATCH 2/3] soc: tegra: make fuse-tegra explicitly non-modular Paul Gortmaker
     [not found]     ` <20161113190302.18099-3-paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org>
2017-04-04 13:25       ` Thierry Reding

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