linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/cpufreq: delete non-required instances of include <linux/init.h>
@ 2014-01-09 15:10 Paul Gortmaker
  2014-01-09 15:17 ` Viresh Kumar
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Gortmaker @ 2014-01-09 15:10 UTC (permalink / raw)
  To: Kevin Hilman, Rafael J. Wysocki; +Cc: cpufreq, linux-pm, Paul Gortmaker

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.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 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(-)

diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index a0acd0bfba40..ba2fcad17941 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -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>
diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c
index 0023c7d40a51..4b85ecbc81b1 100644
--- a/drivers/cpufreq/powernow-k8.c
+++ b/drivers/cpufreq/powernow-k8.c
@@ -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>
diff --git a/drivers/cpufreq/s3c2412-cpufreq.c b/drivers/cpufreq/s3c2412-cpufreq.c
index 4645b4898996..8f42bacbe21b 100644
--- a/drivers/cpufreq/s3c2412-cpufreq.c
+++ b/drivers/cpufreq/s3c2412-cpufreq.c
@@ -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>
diff --git a/drivers/cpufreq/s3c2440-cpufreq.c b/drivers/cpufreq/s3c2440-cpufreq.c
index 72b2cc8a5a85..91d6efb92feb 100644
--- a/drivers/cpufreq/s3c2440-cpufreq.c
+++ b/drivers/cpufreq/s3c2440-cpufreq.c
@@ -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>
diff --git a/drivers/cpufreq/spear-cpufreq.c b/drivers/cpufreq/spear-cpufreq.c
index d02ccd19c9c4..8bdd46905c4c 100644
--- a/drivers/cpufreq/spear-cpufreq.c
+++ b/drivers/cpufreq/spear-cpufreq.c
@@ -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>
diff --git a/drivers/cpufreq/speedstep-lib.c b/drivers/cpufreq/speedstep-lib.c
index 7047821a7f8a..1ef6fb65281b 100644
--- a/drivers/cpufreq/speedstep-lib.c
+++ b/drivers/cpufreq/speedstep-lib.c
@@ -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>
-- 
1.8.5.2


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

* Re: [PATCH] drivers/cpufreq: delete non-required instances of include <linux/init.h>
  2014-01-09 15:10 [PATCH] drivers/cpufreq: delete non-required instances of include <linux/init.h> Paul Gortmaker
@ 2014-01-09 15:17 ` Viresh Kumar
  2014-01-09 15:26   ` Paul Gortmaker
  2014-01-09 15:42   ` Paul Gortmaker
  0 siblings, 2 replies; 5+ messages in thread
From: Viresh Kumar @ 2014-01-09 15:17 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: Kevin Hilman, Rafael J. Wysocki, cpufreq@vger.kernel.org,
	Linux PM list

On Thu, Jan 9, 2014 at 8:40 PM, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:
> 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.

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.

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

* Re: [PATCH] drivers/cpufreq: delete non-required instances of include <linux/init.h>
  2014-01-09 15:17 ` Viresh Kumar
@ 2014-01-09 15:26   ` Paul Gortmaker
  2014-01-09 15:39     ` Viresh Kumar
  2014-01-09 15:42   ` Paul Gortmaker
  1 sibling, 1 reply; 5+ messages in thread
From: Paul Gortmaker @ 2014-01-09 15:26 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Kevin Hilman, Rafael J. Wysocki, cpufreq@vger.kernel.org,
	Linux PM list

On 14-01-09 10:17 AM, Viresh Kumar wrote:
> On Thu, Jan 9, 2014 at 8:40 PM, Paul Gortmaker
> <paul.gortmaker@windriver.com> wrote:
>> 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.
> 
> 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
        fi
done
--------------

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.


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

* Re: [PATCH] drivers/cpufreq: delete non-required instances of include <linux/init.h>
  2014-01-09 15:26   ` Paul Gortmaker
@ 2014-01-09 15:39     ` Viresh Kumar
  0 siblings, 0 replies; 5+ messages in thread
From: Viresh Kumar @ 2014-01-09 15:39 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: Kevin Hilman, Rafael J. Wysocki, cpufreq@vger.kernel.org,
	Linux PM list

On Thu, Jan 9, 2014 at 8:56 PM, Paul Gortmaker
<paul.gortmaker@windriver.com> wrote:
> 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

You missed all initcalls here.

>         if [ $? != 0 ] ; then
>                 echo $i
>                 sed -i '/linux\/init.h/d' $i
>         fi
> done
> --------------
>
> 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

> I will note that
> in this particular case, I couldn't find an ARM defconfig that
> actually enabled any CONFIG_ARM_S3C24xx options though.

Haven't looked into this for now :(

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

* Re: [PATCH] drivers/cpufreq: delete non-required instances of include <linux/init.h>
  2014-01-09 15:17 ` Viresh Kumar
  2014-01-09 15:26   ` Paul Gortmaker
@ 2014-01-09 15:42   ` Paul Gortmaker
  1 sibling, 0 replies; 5+ messages in thread
From: Paul Gortmaker @ 2014-01-09 15:42 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Kevin Hilman, Rafael J. Wysocki, cpufreq@vger.kernel.org,
	Linux PM list

On 14-01-09 10:17 AM, Viresh Kumar wrote:
> On Thu, Jan 9, 2014 at 8:40 PM, Paul Gortmaker
> <paul.gortmaker@windriver.com> wrote:
>> 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.
> 
> 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.

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

end of thread, other threads:[~2014-01-09 15:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-09 15:10 [PATCH] drivers/cpufreq: delete non-required instances of include <linux/init.h> Paul Gortmaker
2014-01-09 15:17 ` Viresh Kumar
2014-01-09 15:26   ` Paul Gortmaker
2014-01-09 15:39     ` Viresh Kumar
2014-01-09 15:42   ` 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).