Skip to contentSkip to conversation

ARM: OMAP3/4: consolidate cpuidle Makefile

PATCH New Daniel Lezcano 3 participants 6 messages May 10, 2012 – May 30, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: OMAP3/4: consolidate cpuidle Makefile

The current Makefile compiles the cpuidle34xx.c and cpuidle44xx.c files even if the cpuidle option is not set in the kernel.

This patch fixes this by creating a section in the Makefile where these files are compiled only if the CONFIG_CPU_IDLE option is set.

This modification breaks an implicit dependency between CPU_IDLE and PM as they belong to the same block in the Makefile. This is fixed in the Kconfig by selecting explicitely PM is CPU_IDLE is set.

The linux coding style recommend to use no-op functions in the headers when the subsystem is disabled instead of adding big section in C files.

This patch fix this also.

---
 arch/arm/mach-omap2/Kconfig       |    2 ++
 arch/arm/mach-omap2/Makefile      |   11 +++++++----
 arch/arm/mach-omap2/cpuidle34xx.c |    8 --------
 arch/arm/mach-omap2/cpuidle44xx.c |    8 --------
 arch/arm/mach-omap2/pm.h          |   17 +++++++++++++++--
 5 files changed, 24 insertions(+), 22 deletions(-)
arch/arm/mach-omap2/Kconfig +2 -0
index 8141b76..42f6b89 100644
@@ -34,6 +34,7 @@ config ARCH_OMAP3
 	select CPU_V7
 	select USB_ARCH_HAS_EHCI if USB_SUPPORT
 	select ARCH_HAS_OPP
+	select PM if CPU_IDLE
 	select PM_OPP if PM
 	select ARM_CPU_SUSPEND if PM
 	select MULTI_IRQ_HANDLER
@@ -51,6 +52,7 @@ config ARCH_OMAP4
 	select PL310_ERRATA_727915
 	select ARM_ERRATA_720789
 	select ARCH_HAS_OPP
+	select PM if CPU_IDLE
 	select PM_OPP if PM
 	select USB_ARCH_HAS_EHCI if USB_SUPPORT
 	select ARM_CPU_SUSPEND if PM
arch/arm/mach-omap2/Makefile +7 -4
index 49f92bc..f46c735 100644
@@ -64,10 +64,8 @@ endif
 ifeq ($(CONFIG_PM),y)
 obj-$(CONFIG_ARCH_OMAP2)		+= pm24xx.o
 obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o
-obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o \
-					   cpuidle34xx.o
-obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o omap-mpuss-lowpower.o \
-					   cpuidle44xx.o
+obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o omap-mpuss-lowpower.o
 obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
 obj-$(CONFIG_OMAP_SMARTREFLEX)          += sr_device.o smartreflex.o
 obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)	+= smartreflex-class3.o
@@ -81,6 +79,11 @@ endif
 
 endif
 
+ifeq ($(CONFIG_CPU_IDLE),y)
+obj-$(CONFIG_ARCH_OMAP3)                += cpuidle34xx.o
+obj-$(CONFIG_ARCH_OMAP4)                += cpuidle44xx.o
+endif
+
 # PRCM
 obj-y					+= prm_common.o
 obj-$(CONFIG_ARCH_OMAP2)		+= prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
arch/arm/mach-omap2/cpuidle34xx.c +0 -8
index 207bc1c..3134452 100644
@@ -36,8 +36,6 @@
 #include "control.h"
 #include "common.h"
 
-#ifdef CONFIG_CPU_IDLE
-
 /* Mach specific information to be recorded in the C-state driver_data */
 struct omap3_idle_statedata {
 	u32 mpu_state;
@@ -379,9 +377,3 @@ int __init omap3_idle_init(void)
 
 	return 0;
 }
-#else
-int __init omap3_idle_init(void)
-{
-	return 0;
-}
-#endif /* CONFIG_CPU_IDLE */
arch/arm/mach-omap2/cpuidle44xx.c +0 -8
index be1617c..02d15bb 100644
@@ -22,8 +22,6 @@
 #include "pm.h"
 #include "prm.h"
 
-#ifdef CONFIG_CPU_IDLE
-
 /* Machine specific information */
 struct omap4_idle_statedata {
 	u32 cpu_state;
@@ -199,9 +197,3 @@ int __init omap4_idle_init(void)
 
 	return 0;
 }
-#else
-int __init omap4_idle_init(void)
-{
-	return 0;
-}
-#endif /* CONFIG_CPU_IDLE */
arch/arm/mach-omap2/pm.h +15 -2
index 7856489..ab04d3b 100644
@@ -15,12 +15,25 @@
 
 #include "powerdomain.h"
 
+#ifdef CONFIG_CPU_IDLE
+extern int __init omap3_idle_init(void);
+extern int __init omap4_idle_init(void);
+#else
+static inline int omap3_idle_init(void)
+{
+	return 0;
+}
+
+static inline int omap4_idle_init(void)
+{
+	return 0;
+}
+#endif
+
 extern void *omap3_secure_ram_storage;
 extern void omap3_pm_off_mode_enable(int);
 extern void omap_sram_idle(void);
 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
-extern int omap3_idle_init(void);
-extern int omap4_idle_init(void);
 extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused);
 extern int (*omap_pm_suspend)(void);
 
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/1 ARM: OMAP3/4: consolidate cpuidle Makefile

Quoted 6 lines · Daniel Lezcano

The current Makefile compiles the cpuidle34xx.c and cpuidle44xx.c files even if the cpuidle option is not set in the kernel.

This patch fixes this by creating a section in the Makefile where these files are compiled only if the CONFIG_CPU_IDLE option is set.

Quoted 6 lines

This modification breaks an implicit dependency between CPU_IDLE and PM as they belong to the same block in the Makefile. This is fixed in the Kconfig by selecting explicitely PM is CPU_IDLE is set.

The linux coding style recommend to use no-op functions in the headers when the subsystem is disabled instead of adding big section in C files.

Looks good to me.

Quoted 140 lines

This patch fix this also.

---
  arch/arm/mach-omap2/Kconfig       |    2 ++
  arch/arm/mach-omap2/Makefile      |   11 +++++++----
  arch/arm/mach-omap2/cpuidle34xx.c |    8 --------
  arch/arm/mach-omap2/cpuidle44xx.c |    8 --------
  arch/arm/mach-omap2/pm.h          |   17 +++++++++++++++--
  5 files changed, 24 insertions(+), 22 deletions(-)
arch/arm/mach-omap2/Kconfig +2 -0
index 8141b76..42f6b89 100644
@@ -34,6 +34,7 @@ config ARCH_OMAP3
  	select CPU_V7
  	select USB_ARCH_HAS_EHCI if USB_SUPPORT
  	select ARCH_HAS_OPP
+	select PM if CPU_IDLE
  	select PM_OPP if PM
  	select ARM_CPU_SUSPEND if PM
  	select MULTI_IRQ_HANDLER
@@ -51,6 +52,7 @@ config ARCH_OMAP4
  	select PL310_ERRATA_727915
  	select ARM_ERRATA_720789
  	select ARCH_HAS_OPP
+	select PM if CPU_IDLE
  	select PM_OPP if PM
  	select USB_ARCH_HAS_EHCI if USB_SUPPORT
  	select ARM_CPU_SUSPEND if PM
arch/arm/mach-omap2/Makefile +7 -4
index 49f92bc..f46c735 100644
@@ -64,10 +64,8 @@ endif
  ifeq ($(CONFIG_PM),y)
  obj-$(CONFIG_ARCH_OMAP2)		+= pm24xx.o
  obj-$(CONFIG_ARCH_OMAP2)		+= sleep24xx.o
-obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o \
-					   cpuidle34xx.o
-obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o omap-mpuss-lowpower.o \
-					   cpuidle44xx.o
+obj-$(CONFIG_ARCH_OMAP3)		+= pm34xx.o sleep34xx.o
+obj-$(CONFIG_ARCH_OMAP4)		+= pm44xx.o omap-mpuss-lowpower.o
  obj-$(CONFIG_PM_DEBUG)			+= pm-debug.o
  obj-$(CONFIG_OMAP_SMARTREFLEX)          += sr_device.o smartreflex.o
  obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)	+= smartreflex-class3.o
@@ -81,6 +79,11 @@ endif
 
  endif
 
+ifeq ($(CONFIG_CPU_IDLE),y)
+obj-$(CONFIG_ARCH_OMAP3)                += cpuidle34xx.o
+obj-$(CONFIG_ARCH_OMAP4)                += cpuidle44xx.o
+endif
+
  # PRCM
  obj-y					+= prm_common.o
  obj-$(CONFIG_ARCH_OMAP2)		+= prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
arch/arm/mach-omap2/cpuidle34xx.c +0 -8
index 207bc1c..3134452 100644
@@ -36,8 +36,6 @@
  #include "control.h"
  #include "common.h"
 
-#ifdef CONFIG_CPU_IDLE
-
  /* Mach specific information to be recorded in the C-state driver_data */
  struct omap3_idle_statedata {
  	u32 mpu_state;
@@ -379,9 +377,3 @@ int __init omap3_idle_init(void)
 
  	return 0;
  }
-#else
-int __init omap3_idle_init(void)
-{
-	return 0;
-}
-#endif /* CONFIG_CPU_IDLE */
arch/arm/mach-omap2/cpuidle44xx.c +0 -8
index be1617c..02d15bb 100644
@@ -22,8 +22,6 @@
  #include "pm.h"
  #include "prm.h"
 
-#ifdef CONFIG_CPU_IDLE
-
  /* Machine specific information */
  struct omap4_idle_statedata {
  	u32 cpu_state;
@@ -199,9 +197,3 @@ int __init omap4_idle_init(void)
 
  	return 0;
  }
-#else
-int __init omap4_idle_init(void)
-{
-	return 0;
-}
-#endif /* CONFIG_CPU_IDLE */
arch/arm/mach-omap2/pm.h +15 -2
index 7856489..ab04d3b 100644
@@ -15,12 +15,25 @@
 
  #include "powerdomain.h"
 
+#ifdef CONFIG_CPU_IDLE
+extern int __init omap3_idle_init(void);
+extern int __init omap4_idle_init(void);
+#else
+static inline int omap3_idle_init(void)
+{
+	return 0;
+}
+
+static inline int omap4_idle_init(void)
+{
+	return 0;
+}
+#endif
+
  extern void *omap3_secure_ram_storage;
  extern void omap3_pm_off_mode_enable(int);
  extern void omap_sram_idle(void);
  extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
-extern int omap3_idle_init(void);
-extern int omap4_idle_init(void);
  extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused);
  extern int (*omap_pm_suspend)(void);
 
#2 lore raw

PATCH 1/1 ARM: OMAP3/4: consolidate cpuidle Makefile

Quoted 13 lines · Rajendra Nayak
Quoted 12 lines · Daniel Lezcano

The current Makefile compiles the cpuidle34xx.c and cpuidle44xx.c files even if the cpuidle option is not set in the kernel.

This patch fixes this by creating a section in the Makefile where these files are compiled only if the CONFIG_CPU_IDLE option is set.

This modification breaks an implicit dependency between CPU_IDLE and PM as
they belong to the same block in the Makefile. This is fixed in the Kconfig
by selecting explicitely PM is CPU_IDLE is set.

Quoted 5 lines
Quoted 2 lines

The linux coding style recommend to use no-op functions in the headers when the subsystem is disabled instead of adding big section in C files.

Looks good to me.

Hi Kevin,

I think I addressed all the points. Is it possible to consider this patch for inclusion ?

Thanks
-- Daniel

Quoted 144 lines
Quoted 143 lines

This patch fix this also.

---
  arch/arm/mach-omap2/Kconfig       |    2 ++
  arch/arm/mach-omap2/Makefile      |   11 +++++++----
  arch/arm/mach-omap2/cpuidle34xx.c |    8 --------
  arch/arm/mach-omap2/cpuidle44xx.c |    8 --------
  arch/arm/mach-omap2/pm.h          |   17 +++++++++++++++--
  5 files changed, 24 insertions(+), 22 deletions(-)
arch/arm/mach-omap2/Kconfig +2 -0
index 8141b76..42f6b89 100644
@@ -34,6 +34,7 @@ config ARCH_OMAP3
      select CPU_V7
      select USB_ARCH_HAS_EHCI if USB_SUPPORT
      select ARCH_HAS_OPP
+    select PM if CPU_IDLE
      select PM_OPP if PM
      select ARM_CPU_SUSPEND if PM
      select MULTI_IRQ_HANDLER
@@ -51,6 +52,7 @@ config ARCH_OMAP4
      select PL310_ERRATA_727915
      select ARM_ERRATA_720789
      select ARCH_HAS_OPP
+    select PM if CPU_IDLE
      select PM_OPP if PM
      select USB_ARCH_HAS_EHCI if USB_SUPPORT
      select ARM_CPU_SUSPEND if PM
arch/arm/mach-omap2/Makefile +7 -4
index 49f92bc..f46c735 100644
@@ -64,10 +64,8 @@ endif
  ifeq ($(CONFIG_PM),y)
  obj-$(CONFIG_ARCH_OMAP2)        += pm24xx.o
  obj-$(CONFIG_ARCH_OMAP2)        += sleep24xx.o
-obj-$(CONFIG_ARCH_OMAP3)        += pm34xx.o sleep34xx.o \
-                       cpuidle34xx.o
-obj-$(CONFIG_ARCH_OMAP4)        += pm44xx.o omap-mpuss-lowpower.o \
-                       cpuidle44xx.o
+obj-$(CONFIG_ARCH_OMAP3)        += pm34xx.o sleep34xx.o
+obj-$(CONFIG_ARCH_OMAP4)        += pm44xx.o omap-mpuss-lowpower.o
  obj-$(CONFIG_PM_DEBUG)            += pm-debug.o
  obj-$(CONFIG_OMAP_SMARTREFLEX)          += sr_device.o smartreflex.o
  obj-$(CONFIG_OMAP_SMARTREFLEX_CLASS3)    += smartreflex-class3.o
@@ -81,6 +79,11 @@ endif
 
  endif
 
+ifeq ($(CONFIG_CPU_IDLE),y)
+obj-$(CONFIG_ARCH_OMAP3)                += cpuidle34xx.o
+obj-$(CONFIG_ARCH_OMAP4)                += cpuidle44xx.o
+endif
+
  # PRCM
  obj-y                    += prm_common.o
  obj-$(CONFIG_ARCH_OMAP2)        += prcm.o cm2xxx_3xxx.o prm2xxx_3xxx.o
arch/arm/mach-omap2/cpuidle34xx.c +0 -2
index 207bc1c..3134452 100644
@@ -36,8 +36,6 @@
  #include "control.h"
  #include "common.h"
 
-#ifdef CONFIG_CPU_IDLE
-
  /* Mach specific information to be recorded in the C-state

driver_data */

  struct omap3_idle_statedata {
      u32 mpu_state;
arch/arm/mach-omap2/cpuidle34xx.c +0 -6
@@ -379,9 +377,3 @@ int __init omap3_idle_init(void)
 
      return 0;
  }
-#else
-int __init omap3_idle_init(void)
-{
-    return 0;
-}
-#endif /* CONFIG_CPU_IDLE */
arch/arm/mach-omap2/cpuidle44xx.c +0 -8
index be1617c..02d15bb 100644
@@ -22,8 +22,6 @@
  #include "pm.h"
  #include "prm.h"
 
-#ifdef CONFIG_CPU_IDLE
-
  /* Machine specific information */
  struct omap4_idle_statedata {
      u32 cpu_state;
@@ -199,9 +197,3 @@ int __init omap4_idle_init(void)
 
      return 0;
  }
-#else
-int __init omap4_idle_init(void)
-{
-    return 0;
-}
-#endif /* CONFIG_CPU_IDLE */
arch/arm/mach-omap2/pm.h +15 -2
index 7856489..ab04d3b 100644
@@ -15,12 +15,25 @@
 
  #include "powerdomain.h"
 
+#ifdef CONFIG_CPU_IDLE
+extern int __init omap3_idle_init(void);
+extern int __init omap4_idle_init(void);
+#else
+static inline int omap3_idle_init(void)
+{
+    return 0;
+}
+
+static inline int omap4_idle_init(void)
+{
+    return 0;
+}
+#endif
+
  extern void *omap3_secure_ram_storage;
  extern void omap3_pm_off_mode_enable(int);
  extern void omap_sram_idle(void);
  extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
-extern int omap3_idle_init(void);
-extern int omap4_idle_init(void);
  extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void
 *unused);
  extern int (*omap_pm_suspend)(void);
Signature · 5 lines
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#3 lore raw

PATCH 1/1 ARM: OMAP3/4: consolidate cpuidle Makefile

Quoted 17 lines · Daniel Lezcano
Quoted 16 lines · Rajendra Nayak
Quoted 14 lines · Daniel Lezcano

The current Makefile compiles the cpuidle34xx.c and cpuidle44xx.c files even if the cpuidle option is not set in the kernel.

This patch fixes this by creating a section in the Makefile where these files are compiled only if the CONFIG_CPU_IDLE option is set.

This modification breaks an implicit dependency between CPU_IDLE and PM as
they belong to the same block in the Makefile. This is fixed in the Kconfig
by selecting explicitely PM is CPU_IDLE is set.

The linux coding style recommend to use no-op functions in the headers when the subsystem is disabled instead of adding big section in C files.

Quoted 8 lines
Quoted 2 lines

Looks good to me.

Hi Kevin,

I think I addressed all the points. Is it possible to consider this patch for inclusion ?

Yes. I'll queue up as a cleanup for v3.6 with the reviewed-by from Rajendra.

Thanks,

Kevin

#4 lore raw

PATCH 1/1 ARM: OMAP3/4: consolidate cpuidle Makefile

Quoted 22 lines · Kevin Hilman
Quoted 20 lines · Daniel Lezcano
Quoted 18 lines · Rajendra Nayak
Quoted 6 lines · Daniel Lezcano

The current Makefile compiles the cpuidle34xx.c and cpuidle44xx.c files even if the cpuidle option is not set in the kernel.

This patch fixes this by creating a section in the Makefile where these files are compiled only if the CONFIG_CPU_IDLE option is set.

Quoted 8 lines

This modification breaks an implicit dependency between CPU_IDLE and PM as
they belong to the same block in the Makefile. This is fixed in the Kconfig
by selecting explicitely PM is CPU_IDLE is set.

The linux coding style recommend to use no-op functions in the headers when the subsystem is disabled instead of adding big section in C files.

Looks good to me.

Quoted 8 lines
Quoted 5 lines

Hi Kevin,

I think I addressed all the points. Is it possible to consider this patch for inclusion ?

Yes. I'll queue up as a cleanup for v3.6 with the reviewed-by from Rajendra.

Cool !

Thanks
-- Daniel

Signature · 5 lines
 <http://www.linaro.org/> Linaro.org ? Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#5 lore raw

PATCH 1/1 ARM: OMAP3/4: consolidate cpuidle Makefile

Quoted 25 lines · Daniel Lezcano
Quoted 24 lines · Kevin Hilman
Quoted 22 lines · Daniel Lezcano
Quoted 13 lines · Rajendra Nayak
Quoted 12 lines · Daniel Lezcano

The current Makefile compiles the cpuidle34xx.c and cpuidle44xx.c files even if the cpuidle option is not set in the kernel.

This patch fixes this by creating a section in the Makefile where these files are compiled only if the CONFIG_CPU_IDLE option is set.

This modification breaks an implicit dependency between CPU_IDLE and PM as
they belong to the same block in the Makefile. This is fixed in the Kconfig
by selecting explicitely PM is CPU_IDLE is set.

Quoted 5 lines
Quoted 2 lines

The linux coding style recommend to use no-op functions in the headers when the subsystem is disabled instead of adding big section in C files.

Looks good to me.

Hi Kevin,

Quoted 9 lines
Quoted 6 lines
Quoted 3 lines

I think I addressed all the points. Is it possible to consider this patch for inclusion ?

Yes. I'll queue up as a cleanup for v3.6 with the reviewed-by from Rajendra.

Cool !

Sorry for the lag. Since this one patch was a bit late for 3.5, I had it on my "to look at later" pile while tracking down various regressions introduced in 3.5.

Kevin