cpuidle : fixup device.h header in cpuidle.h
PATCH 1/1 cpuidle : fixup device.h header in cpuidle.h
The "struct device" is only used in sysfs.c.
The other .c files including the private header "cpuidle.h" do not need to pull the entire headers tree from there as they don't manipulate the "struct device".
This patch fix this by moving the header inclusion to sysfs.c and adding a forward declaration for the struct device.
The number of lines generated by the preprocesor:
Without this patch : 17269 loc
With this patch : 16446 loc
--- drivers/cpuidle/cpuidle.h | 5 +++-- drivers/cpuidle/sysfs.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/cpuidle/cpuidle.h +3 -2
@@ -5,8 +5,6 @@#ifndef __DRIVER_CPUIDLE_H#define __DRIVER_CPUIDLE_H -#include <linux/device.h> -/* For internal use only */ extern struct cpuidle_governor *cpuidle_curr_governor;extern struct list_head cpuidle_governors;
@@ -25,6 +23,9 @@ extern void cpuidle_uninstall_idle_handler(void);extern int cpuidle_switch_governor (struct cpuidle_governor *gov);/* sysfs */ + +struct device ; +extern int cpuidle_add_interface (struct device *dev);extern void cpuidle_remove_interface (struct device *dev);extern int cpuidle_add_state_sysfs (struct cpuidle_device *device);
drivers/cpuidle/sysfs.c +1 -0
@@ -12,6 +12,7 @@#include <linux/slab.h> #include <linux/cpu.h> #include <linux/capability.h> +#include <linux/device.h> #include "cpuidle.h"
Signature · 1 line
1.7.5.4
Rafael J. Wysocki
AppliedQuoted 6 lines · Daniel Lezcano
The "struct device" is only used in
sysfs.c.The other .c files including the private header "
cpuidle.h" do not need to pull the entire headers tree from there as they don't manipulate the "struct device".
Quoted 8 lines
This patch fix this by moving the header inclusion to
sysfs.cand adding a forward declaration for the struct device.The number of lines generated by the preprocesor:
Without this patch : 17269 loc
With this patch : 16446 locSigned-off-by Daniel Lezcano <[email protected]>
Applied to the linux-next branch of linux-pm.git as v3.8 material.
Thanks,
Rafael
Quoted 41 lines
--- drivers/cpuidle/cpuidle.h | 5 +++-- drivers/cpuidle/sysfs.c | 1 + 2 files changed, 4 insertions(+), 2 deletions(-)drivers/cpuidle/cpuidle.h +3
-2@@ -5,8 +5,6 @@#ifndef __DRIVER_CPUIDLE_H#define __DRIVER_CPUIDLE_H -#include <linux/device.h> -/* For internal use only */ extern struct cpuidle_governor *cpuidle_curr_governor;extern struct list_head cpuidle_governors;@@ -25,6 +23,9 @@ extern void cpuidle_uninstall_idle_handler(void);extern int cpuidle_switch_governor (struct cpuidle_governor *gov);/* sysfs */ + +struct device ; +extern int cpuidle_add_interface (struct device *dev);extern void cpuidle_remove_interface (struct device *dev);extern int cpuidle_add_state_sysfs (struct cpuidle_device *device);drivers/cpuidle/sysfs.c +1
-0@@ -12,6 +12,7 @@#include <linux/slab.h> #include <linux/cpu.h> #include <linux/capability.h> +#include <linux/device.h> #include "cpuidle.h"
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.