linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cpuidle : fixup device.h header in cpuidle.h
@ 2012-10-29 14:48 Daniel Lezcano
  2012-10-31  0:43 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Lezcano @ 2012-10-29 14:48 UTC (permalink / raw)
  To: rjw; +Cc: linux-pm, linaro-dev, patches

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

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/cpuidle/cpuidle.h |    5 +++--
 drivers/cpuidle/sysfs.c   |    1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/cpuidle/cpuidle.h b/drivers/cpuidle/cpuidle.h
index 2120d9e..f6b0923 100644
--- a/drivers/cpuidle/cpuidle.h
+++ b/drivers/cpuidle/cpuidle.h
@@ -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);
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index ed87399..860a686 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -12,6 +12,7 @@
 #include <linux/slab.h>
 #include <linux/cpu.h>
 #include <linux/capability.h>
+#include <linux/device.h>
 
 #include "cpuidle.h"
 
-- 
1.7.5.4


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

* Re: [PATCH] cpuidle : fixup device.h header in cpuidle.h
  2012-10-29 14:48 [PATCH] cpuidle : fixup device.h header in cpuidle.h Daniel Lezcano
@ 2012-10-31  0:43 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2012-10-31  0:43 UTC (permalink / raw)
  To: Daniel Lezcano; +Cc: linux-pm, linaro-dev, patches

On Monday, October 29, 2012 03:48:40 PM Daniel Lezcano wrote:
> 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
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

Applied to the linux-next branch of linux-pm.git as v3.8 material.

Thanks,
Rafael


> ---
>  drivers/cpuidle/cpuidle.h |    5 +++--
>  drivers/cpuidle/sysfs.c   |    1 +
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpuidle/cpuidle.h b/drivers/cpuidle/cpuidle.h
> index 2120d9e..f6b0923 100644
> --- a/drivers/cpuidle/cpuidle.h
> +++ b/drivers/cpuidle/cpuidle.h
> @@ -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);
> diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
> index ed87399..860a686 100644
> --- a/drivers/cpuidle/sysfs.c
> +++ b/drivers/cpuidle/sysfs.c
> @@ -12,6 +12,7 @@
>  #include <linux/slab.h>
>  #include <linux/cpu.h>
>  #include <linux/capability.h>
> +#include <linux/device.h>
>  
>  #include "cpuidle.h"
>  
> 
-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

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

end of thread, other threads:[~2012-10-31  0:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-29 14:48 [PATCH] cpuidle : fixup device.h header in cpuidle.h Daniel Lezcano
2012-10-31  0:43 ` Rafael J. Wysocki

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