cpuidle: remove en_core_tk_irqen flag
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 23 Apr 2013 08:54:31 +0000 (08:54 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 23 Apr 2013 11:45:22 +0000 (13:45 +0200)
The en_core_tk_irqen flag is set in all the cpuidle driver which
means it is not necessary to specify this flag.

Remove the flag and the code related to it.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Kevin Hilman <khilman@linaro.org> # for mach-omap2/*
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
23 files changed:
arch/arm/mach-at91/cpuidle.c
arch/arm/mach-davinci/cpuidle.c
arch/arm/mach-exynos/cpuidle.c
arch/arm/mach-imx/cpuidle-imx6q.c
arch/arm/mach-imx/pm-imx5.c
arch/arm/mach-omap2/cpuidle34xx.c
arch/arm/mach-omap2/cpuidle44xx.c
arch/arm/mach-s3c64xx/cpuidle.c
arch/arm/mach-shmobile/cpuidle.c
arch/arm/mach-shmobile/pm-sh7372.c
arch/arm/mach-tegra/cpuidle-tegra114.c
arch/arm/mach-tegra/cpuidle-tegra20.c
arch/arm/mach-tegra/cpuidle-tegra30.c
arch/arm/mach-ux500/cpuidle.c
arch/powerpc/platforms/pseries/processor_idle.c
arch/sh/kernel/cpu/shmobile/cpuidle.c
arch/x86/kernel/apm_32.c
drivers/acpi/processor_idle.c
drivers/cpuidle/cpuidle-calxeda.c
drivers/cpuidle/cpuidle-kirkwood.c
drivers/cpuidle/cpuidle.c
drivers/idle/intel_idle.c
include/linux/cpuidle.h

index 0c6381516a5aac50c0d8752629b2d70f8b554547..0130df7f0524a2369bd79f88f6be986fee7aa0ca 100644 (file)
@@ -47,7 +47,6 @@ static int at91_enter_idle(struct cpuidle_device *dev,
 static struct cpuidle_driver at91_idle_driver = {
        .name                   = "at91_idle",
        .owner                  = THIS_MODULE,
-       .en_core_tk_irqen       = 1,
        .states[0]              = ARM_CPUIDLE_WFI_STATE,
        .states[1]              = {
                .enter                  = at91_enter_idle,
index 22d6d4acc8d914f5c522e162e4cda5a90e8662b5..c2887c57c899bbff0618755e3349fb54ac232148 100644 (file)
@@ -62,7 +62,6 @@ static int davinci_enter_idle(struct cpuidle_device *dev,
 static struct cpuidle_driver davinci_idle_driver = {
        .name                   = "cpuidle-davinci",
        .owner                  = THIS_MODULE,
-       .en_core_tk_irqen       = 1,
        .states[0]              = ARM_CPUIDLE_WFI_STATE,
        .states[1]              = {
                .enter                  = davinci_enter_idle,
index fcfe0251aa3e1c156ec09485574f29aca2870175..498a7a23e2607dfca7dd5db35e3c4eeab3c1027c 100644 (file)
@@ -58,7 +58,6 @@ static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device);
 static struct cpuidle_driver exynos4_idle_driver = {
        .name                   = "exynos4_idle",
        .owner                  = THIS_MODULE,
-       .en_core_tk_irqen       = 1,
 };
 
 /* Ext-GIC nIRQ/nFIQ is the only wakeup source in AFTR */
index a783a6314b4f39fd7a294cc46f7ac78fe384e91c..e2739adf093a4269b2667c45abc4c0761e37a72f 100644 (file)
@@ -45,7 +45,6 @@ done:
 static struct cpuidle_driver imx6q_cpuidle_driver = {
        .name = "imx6q_cpuidle",
        .owner = THIS_MODULE,
-       .en_core_tk_irqen = 1,
        .states = {
                /* WFI */
                ARM_CPUIDLE_WFI_STATE,
index f67fd7ee812773f8e49aecfd2d24f725bf806de3..4b52b3e028abcdda8ceb0d9088db6e2525ad4746 100644 (file)
@@ -164,7 +164,6 @@ static int imx5_cpuidle_enter(struct cpuidle_device *dev,
 static struct cpuidle_driver imx5_cpuidle_driver = {
        .name                   = "imx5_cpuidle",
        .owner                  = THIS_MODULE,
-       .en_core_tk_irqen       = 1,
        .states[0]      = {
                .enter                  = imx5_cpuidle_enter,
                .exit_latency           = 2,
index 0ee39a8b1763955eda316318eff91ed561b921e3..20785b2b0ec82f85c15d6175f70dc0c11c0fba76 100644 (file)
@@ -264,7 +264,6 @@ static DEFINE_PER_CPU(struct cpuidle_device, omap3_idle_dev);
 static struct cpuidle_driver omap3_idle_driver = {
        .name             = "omap3_idle",
        .owner            = THIS_MODULE,
-       .en_core_tk_irqen = 1,
        .states = {
                {
                        .enter            = omap3_enter_idle_bm,
index 8a0e43c69b0b3a2b245b6b4f24dafb8e0de66943..d1bfb21feb7456b449f6e26d743a868bacc0bcd4 100644 (file)
@@ -164,7 +164,6 @@ static DEFINE_PER_CPU(struct cpuidle_device, omap_idle_dev);
 static struct cpuidle_driver omap4_idle_driver = {
        .name                           = "omap4_idle",
        .owner                          = THIS_MODULE,
-       .en_core_tk_irqen               = 1,
        .states = {
                {
                        /* C1 - CPU0 ON + CPU1 ON + MPU ON */
index ead5fab0dbb57b2bd158df077ac0cbc5daccd476..852ff16189f734c0a731f0fca483ce05a68c0ca5 100644 (file)
@@ -45,7 +45,6 @@ static DEFINE_PER_CPU(struct cpuidle_device, s3c64xx_cpuidle_device);
 static struct cpuidle_driver s3c64xx_cpuidle_driver = {
        .name   = "s3c64xx_cpuidle",
        .owner  = THIS_MODULE,
-       .en_core_tk_irqen = 1,
        .states = {
                {
                        .enter            = s3c64xx_enter_idle,
index c872ae8c1cb9df27ee001ce41d9f33228c418863..d671ae90c7a7b4061529c92b7ba38070ef8ab989 100644 (file)
@@ -20,7 +20,6 @@ static struct cpuidle_device shmobile_cpuidle_dev;
 static struct cpuidle_driver shmobile_cpuidle_default_driver = {
        .name                   = "shmobile_cpuidle",
        .owner                  = THIS_MODULE,
-       .en_core_tk_irqen       = 1,
        .states[0]              = ARM_CPUIDLE_WFI_STATE,
        .safe_state_index       = 0, /* C1 */
        .state_count            = 1,
index fbef7b933c1dd0b669bda00a7aa363b0816d0c30..dec9293bb90d167d2433585d7ff4503114896428 100644 (file)
@@ -410,7 +410,6 @@ static int sh7372_enter_a4s(struct cpuidle_device *dev,
 static struct cpuidle_driver sh7372_cpuidle_driver = {
        .name                   = "sh7372_cpuidle",
        .owner                  = THIS_MODULE,
-       .en_core_tk_irqen       = 1,
        .state_count            = 5,
        .safe_state_index       = 0, /* C1 */
        .states[0] = ARM_CPUIDLE_WFI_STATE,
index c527cff47ee05d7c4b8130af5d77f84fb8ead0df..c5fadf9dd90006b3a4d53dc91f4ff9098c2b8bbf 100644 (file)
@@ -23,7 +23,6 @@
 static struct cpuidle_driver tegra_idle_driver = {
        .name = "tegra_idle",
        .owner = THIS_MODULE,
-       .en_core_tk_irqen = 1,
        .state_count = 1,
        .states = {
                [0] = ARM_CPUIDLE_WFI_STATE_PWR(600),
index b94d76a0e0c07debcc400c8195f4b0fc986b72ca..f1f6ac40d7140691344f9a7986e4c9881a5b71f0 100644 (file)
@@ -51,7 +51,6 @@ static int tegra20_idle_lp2_coupled(struct cpuidle_device *dev,
 static struct cpuidle_driver tegra_idle_driver = {
        .name = "tegra_idle",
        .owner = THIS_MODULE,
-       .en_core_tk_irqen = 1,
        .states = {
                ARM_CPUIDLE_WFI_STATE_PWR(600),
 #ifdef CONFIG_PM_SLEEP
index c4e01fe0fde4619fd9912b4d85ecbd3d5a347d53..f6a0c7291c35180df888a794a0f5afc1ef8be625 100644 (file)
@@ -43,7 +43,6 @@ static int tegra30_idle_lp2(struct cpuidle_device *dev,
 static struct cpuidle_driver tegra_idle_driver = {
        .name = "tegra_idle",
        .owner = THIS_MODULE,
-       .en_core_tk_irqen = 1,
 #ifdef CONFIG_PM_SLEEP
        .state_count = 2,
 #else
index 1b16d9ebecda50550c244b7394cd85c52c9490e1..c29c1bf5ff8be2e7c0f20fefb97442bf114bfb6e 100644 (file)
@@ -94,7 +94,6 @@ out:
 static struct cpuidle_driver ux500_idle_driver = {
        .name = "ux500_idle",
        .owner = THIS_MODULE,
-       .en_core_tk_irqen = 1,
        .states = {
                ARM_CPUIDLE_WFI_STATE,
                {
index a197120e169ad313f96de1f08c51ff54c08d61ae..4644efa069411e8f797ff53f1a853620278ca3a4 100644 (file)
@@ -25,7 +25,6 @@
 struct cpuidle_driver pseries_idle_driver = {
        .name             = "pseries_idle",
        .owner            = THIS_MODULE,
-       .en_core_tk_irqen = 1,
 };
 
 #define MAX_IDLE_STATE_COUNT   2
index ea6ab0278490b99ffe70c2ea9eb6e4cdf0543025..fdfe57f42b8c21407e59855d2b18af13d438af07 100644 (file)
@@ -55,7 +55,6 @@ static struct cpuidle_device cpuidle_dev;
 static struct cpuidle_driver cpuidle_driver = {
        .name   = "sh_idle",
        .owner  = THIS_MODULE,
-       .en_core_tk_irqen = 1,
        .states = {
                {
                        .exit_latency = 1,
index 66b5faffe14a983e7c39d201c3c50a4ef1126e32..53a4e274484698ad00e0e59f592fcfb4977e5c00 100644 (file)
@@ -373,7 +373,6 @@ static int apm_cpu_idle(struct cpuidle_device *dev,
 static struct cpuidle_driver apm_idle_driver = {
        .name = "apm_idle",
        .owner = THIS_MODULE,
-       .en_core_tk_irqen = 1,
        .states = {
                { /* entry 0 is for polling */ },
                { /* entry 1 is for APM idle */
index ee255c60bdacc5a53849d23a5f0c1332e5f64b22..f0df2c9434d2ee14809db94e9150b48de0878a7d 100644 (file)
@@ -918,7 +918,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
 struct cpuidle_driver acpi_idle_driver = {
        .name =         "acpi_idle",
        .owner =        THIS_MODULE,
-       .en_core_tk_irqen = 1,
 };
 
 /**
index e1aab38c5a8da19b076fcc0586565b20313990d5..a3b56f5d33bde0b4eee4319f5b4e1561299ac323 100644 (file)
@@ -100,7 +100,6 @@ static void calxeda_idle_cpuidle_devices_uninit(void)
 
 static struct cpuidle_driver calxeda_idle_driver = {
        .name = "calxeda_idle",
-       .en_core_tk_irqen = 1,
        .states = {
                ARM_CPUIDLE_WFI_STATE,
                {
index 53aad732496558407c4ff1785ee3e634c96eec98..6f31524369830bd4b9fef783d1261877caf05b3b 100644 (file)
@@ -41,7 +41,6 @@ static int kirkwood_enter_idle(struct cpuidle_device *dev,
 static struct cpuidle_driver kirkwood_idle_driver = {
        .name                   = "kirkwood_idle",
        .owner                  = THIS_MODULE,
-       .en_core_tk_irqen       = 1,
        .states[0]              = ARM_CPUIDLE_WFI_STATE,
        .states[1]              = {
                .enter                  = kirkwood_enter_idle,
index c50037029184b1e507690d133cd2ef87aa8c2c05..0da795b9dbbf19b083130b8ea776f420ad4f51c5 100644 (file)
@@ -43,24 +43,6 @@ void disable_cpuidle(void)
 
 static int __cpuidle_register_device(struct cpuidle_device *dev);
 
-static inline int cpuidle_enter(struct cpuidle_device *dev,
-                               struct cpuidle_driver *drv, int index)
-{
-       struct cpuidle_state *target_state = &drv->states[index];
-       return target_state->enter(dev, drv, index);
-}
-
-static inline int cpuidle_enter_tk(struct cpuidle_device *dev,
-                              struct cpuidle_driver *drv, int index)
-{
-       return cpuidle_wrap_enter(dev, drv, index, cpuidle_enter);
-}
-
-typedef int (*cpuidle_enter_t)(struct cpuidle_device *dev,
-                              struct cpuidle_driver *drv, int index);
-
-static cpuidle_enter_t cpuidle_enter_ops;
-
 /**
  * cpuidle_play_dead - cpu off-lining
  *
@@ -90,11 +72,27 @@ int cpuidle_play_dead(void)
  * @next_state: index into drv->states of the state to enter
  */
 int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
-               int next_state)
+                       int index)
 {
        int entered_state;
 
-       entered_state = cpuidle_enter_ops(dev, drv, next_state);
+       struct cpuidle_state *target_state = &drv->states[index];
+       ktime_t time_start, time_end;
+       s64 diff;
+
+       time_start = ktime_get();
+
+       entered_state = target_state->enter(dev, drv, index);
+
+       time_end = ktime_get();
+
+       local_irq_enable();
+
+       diff = ktime_to_us(ktime_sub(time_end, time_start));
+       if (diff > INT_MAX)
+               diff = INT_MAX;
+
+       dev->last_residency = (int) diff;
 
        if (entered_state >= 0) {
                /* Update cpuidle counters */
@@ -231,37 +229,6 @@ void cpuidle_resume(void)
        mutex_unlock(&cpuidle_lock);
 }
 
-/**
- * cpuidle_wrap_enter - performs timekeeping and irqen around enter function
- * @dev: pointer to a valid cpuidle_device object
- * @drv: pointer to a valid cpuidle_driver object
- * @index: index of the target cpuidle state.
- */
-int cpuidle_wrap_enter(struct cpuidle_device *dev,
-                               struct cpuidle_driver *drv, int index,
-                               int (*enter)(struct cpuidle_device *dev,
-                                       struct cpuidle_driver *drv, int index))
-{
-       ktime_t time_start, time_end;
-       s64 diff;
-
-       time_start = ktime_get();
-
-       index = enter(dev, drv, index);
-
-       time_end = ktime_get();
-
-       local_irq_enable();
-
-       diff = ktime_to_us(ktime_sub(time_end, time_start));
-       if (diff > INT_MAX)
-               diff = INT_MAX;
-
-       dev->last_residency = (int) diff;
-
-       return index;
-}
-
 #ifdef CONFIG_ARCH_HAS_CPU_RELAX
 static int poll_idle(struct cpuidle_device *dev,
                struct cpuidle_driver *drv, int index)
@@ -333,9 +300,6 @@ int cpuidle_enable_device(struct cpuidle_device *dev)
                        return ret;
        }
 
-       cpuidle_enter_ops = drv->en_core_tk_irqen ?
-               cpuidle_enter_tk : cpuidle_enter;
-
        poll_idle_init(drv);
 
        ret = cpuidle_add_device_sysfs(dev);
index c99c31e8a8213135a205da0f11e6ffecafe69c92..6f80c132d4c9a2a94f8c13c1c8c5058a58d82399 100644 (file)
@@ -71,7 +71,6 @@
 static struct cpuidle_driver intel_idle_driver = {
        .name = "intel_idle",
        .owner = THIS_MODULE,
-       .en_core_tk_irqen = 1,
 };
 /* intel_idle.max_cstate=0 disables driver */
 static int max_cstate = CPUIDLE_STATE_MAX - 1;
index fc3e5808b7ffa8b426679a3edfa6e6c21de9dfb1..79e38114e5f48c2603831d806b81903db1690ccb 100644 (file)
@@ -105,8 +105,6 @@ struct cpuidle_driver {
        struct module           *owner;
        int                     refcnt;
 
-       /* set to 1 to use the core cpuidle time keeping (for all states). */
-       unsigned int            en_core_tk_irqen:1;
         /* used by the cpuidle framework to setup the broadcast timer */
        unsigned int            bctimer:1;
        /* states array must be ordered in decreasing power consumption */
@@ -132,10 +130,6 @@ extern void cpuidle_pause(void);
 extern void cpuidle_resume(void);
 extern int cpuidle_enable_device(struct cpuidle_device *dev);
 extern void cpuidle_disable_device(struct cpuidle_device *dev);
-extern int cpuidle_wrap_enter(struct cpuidle_device *dev,
-                               struct cpuidle_driver *drv, int index,
-                               int (*enter)(struct cpuidle_device *dev,
-                                       struct cpuidle_driver *drv, int index));
 extern int cpuidle_play_dead(void);
 
 extern struct cpuidle_driver *cpuidle_get_cpu_driver(struct cpuidle_device *dev);
@@ -162,11 +156,6 @@ static inline void cpuidle_resume(void) { }
 static inline int cpuidle_enable_device(struct cpuidle_device *dev)
 {return -ENODEV; }
 static inline void cpuidle_disable_device(struct cpuidle_device *dev) { }
-static inline int cpuidle_wrap_enter(struct cpuidle_device *dev,
-                               struct cpuidle_driver *drv, int index,
-                               int (*enter)(struct cpuidle_device *dev,
-                                       struct cpuidle_driver *drv, int index))
-{ return -ENODEV; }
 static inline int cpuidle_play_dead(void) {return -ENODEV; }
 #endif