drivers/cpufreq: delete non-required instances of include <linux/init.h>
Subsystems (2)
PATCH 1/1 drivers/cpufreq: delete non-required instances of include <linux/init.h>
None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next.
--- drivers/cpufreq/omap-cpufreq.c | 1 - drivers/cpufreq/powernow-k8.c | 1 - drivers/cpufreq/s3c2412-cpufreq.c | 1 - drivers/cpufreq/s3c2440-cpufreq.c | 1 - drivers/cpufreq/spear-cpufreq.c | 1 - drivers/cpufreq/speedstep-lib.c | 1 - 6 files changed, 6 deletions(-)
drivers/cpufreq/omap-cpufreq.c +0 -1
@@ -18,7 +18,6 @@#include <linux/sched.h> #include <linux/cpufreq.h> #include <linux/delay.h> -#include <linux/init.h> #include <linux/err.h> #include <linux/clk.h> #include <linux/io.h>
drivers/cpufreq/powernow-k8.c +0 -1
@@ -30,7 +30,6 @@#include <linux/kernel.h> #include <linux/smp.h> #include <linux/module.h> -#include <linux/init.h> #include <linux/cpufreq.h> #include <linux/slab.h> #include <linux/string.h>
drivers/cpufreq/s3c2412-cpufreq.c +0 -1
@@ -10,7 +10,6 @@* published by the Free Software Foundation. */ -#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/ioport.h>
drivers/cpufreq/s3c2440-cpufreq.c +0 -1
@@ -11,7 +11,6 @@* published by the Free Software Foundation. */ -#include <linux/init.h> #include <linux/module.h> #include <linux/interrupt.h> #include <linux/ioport.h>
drivers/cpufreq/spear-cpufreq.c +0 -1
@@ -16,7 +16,6 @@#include <linux/clk.h> #include <linux/cpufreq.h> #include <linux/err.h> -#include <linux/init.h> #include <linux/module.h> #include <linux/of_device.h> #include <linux/slab.h>
drivers/cpufreq/speedstep-lib.c +0 -1
@@ -11,7 +11,6 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/moduleparam.h> -#include <linux/init.h> #include <linux/cpufreq.h> #include <asm/msr.h>
Signature · 1 line
1.8.5.2
Viresh Kumar
maintainerQuoted 4 lines · Paul Gortmaker
None of these files are actually using any
__inittype directives and hence don't need to include <linux/init.h>. Most are just a left over from__devinitand__cpuinitremoval, or simply due to code getting copied from one driver to the next.
Are you sure? Its not only about devinit or cpuinit but module_init() and others as well. And they are pretty much used by most of them.
Quoted 9 lines · Viresh Kumar
Quoted 4 lines · Paul Gortmaker
None of these files are actually using any
__inittype directives and hence don't need to include <linux/init.h>. Most are just a left over from__devinitand__cpuinitremoval, or simply due to code getting copied from one driver to the next.Are you sure? Its not only about devinit or cpuinit but
module_init()and others as well. And they are pretty much used by most of them.
Yes I am sure. I start with this:
-------------
#!/bin/bash
if [ "$1" = "" ]; then
echo must supply path name
exit 1
fi
for i in git grep -l linux/init.h $1 ; do
grep -q '__ref\|__init\|__cpuinit\|__meminit\|__MEMINIT\|__CPUINIT\|__INIT\|__REF\|__HEAD' $i
if [ $? != 0 ] ; then
echo $i
sed -i '/linux\/init.h/d' $i
fidone
--------------
which as you can see whitelists any real users, and then I follow up with build testing to double check. I will note that in this particular case, I couldn't find an ARM defconfig that actually enabled any CONFIG_ARM_S3C24xx options though.
Paul.
Viresh Kumar
maintainerQuoted 5 lines · Paul Gortmaker
Yes I am sure. I start with this:
-------------
#!/bin/bash
Quoted 7 lines
if [ "$1" = "" ]; then
echo must supply path name
exit 1
fifor i in
git grep -l linux/init.h $1; dogrep -q '__ref\|__init\|__cpuinit\|__meminit\|__MEMINIT\|__CPUINIT\|__INIT\|__REF\|__HEAD' $i
You missed all initcalls here.
Quoted 9 lines
if [ $? != 0 ] ; then echo $i sed -i '/linux\/init.h/d' $i fidone
--------------which as you can see whitelists any real users, and then I follow up with build testing to double check.
That might have passed because init.h is still included indirectly.
These are the usages which I can see easily, there might be others too..
drivers/cpufreq/powernow-k8.c: late_initcall and module_exit drivers/cpufreq/s3c2412-cpufreq.c: arch_initcall drivers/cpufreq/s3c2440-cpufreq.c: subsys_initcall drivers/cpufreq/spear-cpufreq.c: late_initcall
Quoted 3 lines
I will note that
in this particular case, I couldn't find an ARM defconfig that actually enabled anyCONFIG_ARM_S3C24xxoptions though.
Haven't looked into this for now :(
Quoted 9 lines · Viresh Kumar
Quoted 4 lines · Paul Gortmaker
None of these files are actually using any
__inittype directives and hence don't need to include <linux/init.h>. Most are just a left over from__devinitand__cpuinitremoval, or simply due to code getting copied from one driver to the next.Are you sure? Its not only about devinit or cpuinit but
module_init()and others as well. And they are pretty much used by most of them.
Actually, module_init is an interesting point; we are implicitly getting init.h in module.h -- but (1) that should be explicit, and (2) module_init should/could really be in module.h and not stuck in init.h
I'll add that to my queue and do some testing.
Thanks for the comments,
Paul.