From: Paul Gortmaker <hidden> Date: 2016-03-27 22:09:53
My ongoing audit looking for non-modular code that needlessly uses
modular macros (vs. built-in equivalents) and/or has dead code
relating to module unloading that can never be executed led to the
creation of these three powerpc related commits.
One is of the trivial kind, where we substitute in the non-modular
versions that CPP would have put in place anyway, resulting in no
actual changes, even at the binary output level.
The other two are almost as trivial. In addition to the above, we
toss out the __exit function registered by module_exit, since that
will never get called for non modular code/drivers.
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.
Build tested on v4.6-rc1 to ensure no silly typos that would break
compilation crept in.
---
Cc: Andrzej Hajda <redacted>
Cc: Anton Blanchard <redacted>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Christian Krafft <redacted>
Cc: Hari Bathini <redacted>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Nathan Fontenot <redacted>
Cc: Paul Mackerras <redacted>
Cc: "Rafael J. Wysocki" <redacted>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: linux-pm@vger.kernel.org
Cc: linuxppc-dev@lists.ozlabs.org
Paul Gortmaker (3):
powerpc: make cell/spu_base.c explicitly non-modular
powerpc: make kernel/nvram_64.c explicitly non-modular
drivers/cpufreq: make ppc_cbe_cpufreq_pmi driver explicitly
non-modular
arch/powerpc/kernel/nvram_64.c | 12 +-----------
arch/powerpc/platforms/cell/spu_base.c | 7 ++-----
drivers/cpufreq/ppc_cbe_cpufreq_pmi.c | 15 ++-------------
3 files changed, 5 insertions(+), 29 deletions(-)
--
2.6.1
From: Paul Gortmaker <hidden> Date: 2016-03-27 22:09:41
The Kconfig currently controlling compilation of this code is:
arch/powerpc/platforms/cell/Kconfig:config SPU_BASE
arch/powerpc/platforms/cell/Kconfig: bool
...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 translates to device_initcall in the non-modular
case, 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: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <redacted>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Paul Gortmaker <redacted>
---
arch/powerpc/platforms/cell/spu_base.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-04-11 12:35:09
On Sun, 2016-27-03 at 22:08:15 UTC, Paul Gortmaker wrote:
The Kconfig currently controlling compilation of this code is:
arch/powerpc/platforms/cell/Kconfig:config SPU_BASE
arch/powerpc/platforms/cell/Kconfig: bool
...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.
From: Paul Gortmaker <hidden> Date: 2016-03-27 22:09:47
The Kconfig for this driver is currently:
config CPU_FREQ_CBE_PMI
bool "CBE frequency scaling using PMI interface"
...meaning that it currently is not being built as a module by
anyone. Lets remove the modular and unused code here, so that
when reading the driver there is no doubt it is builtin-only.
Since module_init translates to device_initcall in the non-modular
case, 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: "Rafael J. Wysocki" <redacted>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Christian Krafft <redacted>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <redacted>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-pm@vger.kernel.org
Signed-off-by: Paul Gortmaker <redacted>
---
drivers/cpufreq/ppc_cbe_cpufreq_pmi.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
The Kconfig for this driver is currently:
config CPU_FREQ_CBE_PMI
bool "CBE frequency scaling using PMI interface"
...meaning that it currently is not being built as a module by
anyone. Lets remove the modular and unused code here, so that
when reading the driver there is no doubt it is builtin-only.
Since module_init translates to device_initcall in the non-modular
case, 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: "Rafael J. Wysocki" <redacted>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Christian Krafft <redacted>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <redacted>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-pm@vger.kernel.org
Signed-off-by: Paul Gortmaker <redacted>
---
drivers/cpufreq/ppc_cbe_cpufreq_pmi.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-04-11 12:35:19
On Sun, 2016-27-03 at 22:08:17 UTC, Paul Gortmaker wrote:
The Kconfig for this driver is currently:
config CPU_FREQ_CBE_PMI
bool "CBE frequency scaling using PMI interface"
...meaning that it currently is not being built as a module by
anyone. Lets remove the modular and unused code here, so that
when reading the driver there is no doubt it is builtin-only.
...
Signed-off-by: Paul Gortmaker <redacted>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
From: Paul Gortmaker <hidden> Date: 2016-03-27 22:10:12
The Makefile/Kconfig currently controlling compilation of this code is:
obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
signal_64.o ptrace32.o \
paca.o nvram_64.o firmware.o
arch/powerpc/platforms/Kconfig.cputype:config PPC64
arch/powerpc/platforms/Kconfig.cputype: bool "64-bit kernel"
...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 translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.
We don't replace module.h with init.h since the file already has that.
We delete the MODULE_LICENSE tag since that information is already
contained at the top of the file in the comments.
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <redacted>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Hari Bathini <redacted>
Cc: Nathan Fontenot <redacted>
Cc: Andrzej Hajda <redacted>
Cc: Anton Blanchard <redacted>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Paul Gortmaker <redacted>
---
arch/powerpc/kernel/nvram_64.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
The Makefile/Kconfig currently controlling compilation of this code is:
obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
signal_64.o ptrace32.o \
paca.o nvram_64.o firmware.o
arch/powerpc/platforms/Kconfig.cputype:config PPC64
arch/powerpc/platforms/Kconfig.cputype: bool "64-bit kernel"
...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 translates to device_initcall in the non-modular
case, the init ordering remains unchanged with this commit.
We don't replace module.h with init.h since the file already has that.
We delete the MODULE_LICENSE tag since that information is already
contained at the top of the file in the comments.
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <redacted>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Hari Bathini <redacted>
Cc: Nathan Fontenot <redacted>
Cc: Andrzej Hajda <redacted>
Cc: Anton Blanchard <redacted>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Paul Gortmaker <redacted>
---
I think at some point in the past we thought this may be useful as a module
but I'm not sure it has ever been used that way.
Reviewed-by: Nathan Fontenot <redacted>
From: Michael Ellerman <mpe@ellerman.id.au> Date: 2016-04-11 12:35:13
On Sun, 2016-27-03 at 22:08:16 UTC, Paul Gortmaker wrote:
The Makefile/Kconfig currently controlling compilation of this code is:
obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
signal_64.o ptrace32.o \
paca.o nvram_64.o firmware.o
arch/powerpc/platforms/Kconfig.cputype:config PPC64
arch/powerpc/platforms/Kconfig.cputype: bool "64-bit kernel"
...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.
...
Signed-off-by: Paul Gortmaker <redacted>
Reviewed-by: Nathan Fontenot <redacted>