Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312706
b: refs/heads/master
c: 8651f97
h: refs/heads/master
v: v3
  • Loading branch information
Preeti U Murthy authored and Rafael J. Wysocki committed Jul 10, 2012
1 parent bda0ae6 commit 8670004
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 31 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 25ac77613aa8fca131599705e3d7da2a0eaa06a0
refs/heads/master: 8651f97bd951d0bb1c10fa24e3fa3455193f3548
30 changes: 1 addition & 29 deletions trunk/drivers/acpi/processor_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,6 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr,

#endif

/*
* Suspend / resume control
*/
static int acpi_idle_suspend;
static u32 saved_bm_rld;

static void acpi_idle_bm_rld_save(void)
Expand All @@ -243,21 +239,13 @@ static void acpi_idle_bm_rld_restore(void)

int acpi_processor_suspend(struct acpi_device * device, pm_message_t state)
{
if (acpi_idle_suspend == 1)
return 0;

acpi_idle_bm_rld_save();
acpi_idle_suspend = 1;
return 0;
}

int acpi_processor_resume(struct acpi_device * device)
{
if (acpi_idle_suspend == 0)
return 0;

acpi_idle_bm_rld_restore();
acpi_idle_suspend = 0;
return 0;
}

Expand Down Expand Up @@ -763,11 +751,6 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,

local_irq_disable();

if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}

lapic_timer_state_broadcast(pr, cx, 1);
kt1 = ktime_get_real();
Expand Down Expand Up @@ -838,11 +821,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,

local_irq_disable();

if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}

if (cx->entry_method != ACPI_CSTATE_FFH) {
current_thread_info()->status &= ~TS_POLLING;
Expand Down Expand Up @@ -928,20 +906,14 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
drv, drv->safe_state_index);
} else {
local_irq_disable();
if (!acpi_idle_suspend)
acpi_safe_halt();
acpi_safe_halt();
local_irq_enable();
return -EBUSY;
}
}

local_irq_disable();

if (acpi_idle_suspend) {
local_irq_enable();
cpu_relax();
return -EBUSY;
}

if (cx->entry_method != ACPI_CSTATE_FFH) {
current_thread_info()->status &= ~TS_POLLING;
Expand Down
4 changes: 3 additions & 1 deletion trunk/drivers/base/power/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <linux/sched.h>
#include <linux/async.h>
#include <linux/suspend.h>

#include <linux/cpuidle.h>
#include "../base.h"
#include "power.h"

Expand Down Expand Up @@ -467,6 +467,7 @@ static void dpm_resume_noirq(pm_message_t state)
mutex_unlock(&dpm_list_mtx);
dpm_show_time(starttime, state, "noirq");
resume_device_irqs();
cpuidle_resume();
}

/**
Expand Down Expand Up @@ -867,6 +868,7 @@ static int dpm_suspend_noirq(pm_message_t state)
ktime_t starttime = ktime_get();
int error = 0;

cpuidle_pause();
suspend_device_irqs();
mutex_lock(&dpm_list_mtx);
while (!list_empty(&dpm_late_early_list)) {
Expand Down
16 changes: 16 additions & 0 deletions trunk/drivers/cpuidle/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,22 @@ void cpuidle_resume_and_unlock(void)

EXPORT_SYMBOL_GPL(cpuidle_resume_and_unlock);

/* Currently used in suspend/resume path to suspend cpuidle */
void cpuidle_pause(void)
{
mutex_lock(&cpuidle_lock);
cpuidle_uninstall_idle_handler();
mutex_unlock(&cpuidle_lock);
}

/* Currently used in suspend/resume path to resume cpuidle */
void cpuidle_resume(void)
{
mutex_lock(&cpuidle_lock);
cpuidle_install_idle_handler();
mutex_unlock(&cpuidle_lock);
}

/**
* cpuidle_wrap_enter - performs timekeeping and irqen around enter function
* @dev: pointer to a valid cpuidle_device object
Expand Down
4 changes: 4 additions & 0 deletions trunk/include/linux/cpuidle.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ extern void cpuidle_unregister_device(struct cpuidle_device *dev);

extern void cpuidle_pause_and_lock(void);
extern void cpuidle_resume_and_unlock(void);
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,
Expand All @@ -168,6 +170,8 @@ static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { }

static inline void cpuidle_pause_and_lock(void) { }
static inline void cpuidle_resume_and_unlock(void) { }
static inline void cpuidle_pause(void) { }
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) { }
Expand Down

0 comments on commit 8670004

Please sign in to comment.