本文整理汇总了C++中pm_restrict_gfp_mask函数的典型用法代码示例。如果您正苦于以下问题:C++ pm_restrict_gfp_mask函数的具体用法?C++ pm_restrict_gfp_mask怎么用?C++ pm_restrict_gfp_mask使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pm_restrict_gfp_mask函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: enter_state
static int enter_state(suspend_state_t state)
{
int error;
if (!valid_state(state))
return -ENODEV;
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
if (state == PM_SUSPEND_FREEZE)
freeze_begin();
suspend_sys_sync_queue();
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
error = suspend_prepare(state);
if (error)
goto Unlock;
if (suspend_test(TEST_FREEZER))
goto Finish;
pr_debug("PM: Entering %s sleep\n", pm_states[state]);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
Finish:
pr_debug("PM: Finishing wakeup.\n");
suspend_finish();
Unlock:
mutex_unlock(&pm_mutex);
return error;
}
开发者ID:anticline,项目名称:android_kernel_htc_msm8939,代码行数:34,代码来源:suspend.c
示例2: hibernation_restore
/**
* hibernation_restore - Quiesce devices and restore from a hibernation image.
* @platform_mode: If set, use platform driver to prepare for the transition.
*
* This routine must be called with pm_mutex held. If it is successful, control
* reappears in the restored target kernel in hibernation_snapshot().
*/
int hibernation_restore(int platform_mode)
{
int error;
pm_prepare_console();
suspend_console();
ftrace_stop();
pm_restrict_gfp_mask();
error = dpm_suspend_start(PMSG_QUIESCE);
if (!error) {
error = resume_target_kernel(platform_mode);
/*
* The above should either succeed and jump to the new kernel,
* or return with an error. Otherwise things are just
* undefined, so let's be paranoid.
*/
BUG_ON(!error);
}
dpm_resume_end(PMSG_RECOVER);
pm_restore_gfp_mask();
ftrace_start();
resume_console();
pm_restore_console();
return error;
}
开发者ID:AudioGod,项目名称:MediaTek-HelioX10-Kernel,代码行数:32,代码来源:hibernate.c
示例3: enter_state
/**
* enter_state - Do common work needed to enter system sleep state.
* @state: System sleep state to enter.
*
* Make sure that no one else is trying to put the system into a sleep state.
* Fail if that's not the case. Otherwise, prepare for system suspend, make the
* system enter the given sleep state and clean up after wakeup.
*/
int enter_state(suspend_state_t state)
{
int error;
if (!valid_state(state))
return -ENODEV;
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
printk(KERN_INFO "PM: Syncing filesystems ... ");
sys_sync();
printk("done.\n");
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
error = suspend_prepare();
if (error)
goto Unlock;
if (suspend_test(TEST_FREEZER))
goto Finish;
pr_debug("PM: Entering %s sleep\n", pm_states[state]);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
Finish:
pr_debug("PM: Finishing wakeup.\n");
suspend_finish();
Unlock:
mutex_unlock(&pm_mutex);
return error;
}
开发者ID:GREYFOXRGR,项目名称:BPI-M3-bsp,代码行数:42,代码来源:suspend.c
示例4: enter_state
/**
* enter_state - Do common work of entering low-power state.
* @state: pm_state structure for state we're entering.
*
* Make sure we're the only ones trying to enter a sleep state. Fail
* if someone has beat us to it, since we don't want anything weird to
* happen when we wake up.
* Then, do the setup for suspend, enter the state, and cleaup (after
* we've woken up).
*/
int enter_state(suspend_state_t state)
{
int error;
struct task_struct *cpu_task;
if (!valid_state(state))
return -ENODEV;
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
/*
* Assure that previous started thread is completed before
* attempting to suspend again.
*/
error = wait_for_completion_timeout(&second_cpu_complete,
msecs_to_jiffies(500));
WARN_ON(error == 0);
#ifdef CONFIG_PM_SYNC_CTRL
if (pm_sync_active) {
;
sys_sync();
;
}
#else
;
sys_sync();
;
#endif
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
error = suspend_prepare();
if (error)
goto Unlock;
if (suspend_test(TEST_FREEZER))
goto Finish;
pr_debug("PM: Entering %s sleep\n", pm_states[state]);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
Finish:
pr_debug("PM: Finishing wakeup.\n");
suspend_finish();
Unlock:
cpu_task = kthread_run(plug_secondary_cpus,
NULL, "cpu-plug");
BUG_ON(IS_ERR(cpu_task));
mutex_unlock(&pm_mutex);
return error;
}
开发者ID:rrowicki,项目名称:Chrono_Kernel-1,代码行数:65,代码来源:suspend.c
示例5: enter_state
/**
* enter_state - Do common work needed to enter system sleep state.
* @state: System sleep state to enter.
*
* Make sure that no one else is trying to put the system into a sleep state.
* Fail if that's not the case. Otherwise, prepare for system suspend, make the
* system enter the given sleep state and clean up after wakeup.
*/
static int enter_state(suspend_state_t state)
{
int error;
trace_suspend_resume(TPS("suspend_enter"), state, true);
if (state == PM_SUSPEND_TO_IDLE) {
#ifdef CONFIG_PM_DEBUG
if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) {
pr_warn("Unsupported test mode for suspend to idle, please choose none/freezer/devices/platform.\n");
return -EAGAIN;
}
#endif
} else if (!valid_state(state)) {
return -EINVAL;
}
if (!mutex_trylock(&system_transition_mutex))
return -EBUSY;
if (state == PM_SUSPEND_TO_IDLE)
s2idle_begin();
#ifndef CONFIG_SUSPEND_SKIP_SYNC
trace_suspend_resume(TPS("sync_filesystems"), 0, true);
pr_info("Syncing filesystems ... ");
ksys_sync();
pr_cont("done.\n");
trace_suspend_resume(TPS("sync_filesystems"), 0, false);
#endif
pm_pr_dbg("Preparing system for sleep (%s)\n", mem_sleep_labels[state]);
pm_suspend_clear_flags();
error = suspend_prepare(state);
if (error)
goto Unlock;
if (suspend_test(TEST_FREEZER))
goto Finish;
trace_suspend_resume(TPS("suspend_enter"), state, false);
pm_pr_dbg("Suspending system (%s)\n", mem_sleep_labels[state]);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
Finish:
events_check_enabled = false;
pm_pr_dbg("Finishing wakeup.\n");
suspend_finish();
Unlock:
mutex_unlock(&system_transition_mutex);
return error;
}
开发者ID:guribe94,项目名称:linux,代码行数:60,代码来源:suspend.c
示例6: enter_state
/**
* enter_state - Do common work needed to enter system sleep state.
* @state: System sleep state to enter.
*
* Make sure that no one else is trying to put the system into a sleep state.
* Fail if that's not the case. Otherwise, prepare for system suspend, make the
* system enter the given sleep state and clean up after wakeup.
*/
static int enter_state(suspend_state_t state)
{
int error;
if (state == PM_SUSPEND_FREEZE) {
#ifdef CONFIG_PM_DEBUG
if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) {
pr_warning("PM: Unsupported test mode for freeze state,"
"please choose none/freezer/devices/platform.\n");
return -EAGAIN;
}
#endif
} else if (!valid_state(state)) {
return -EINVAL;
}
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
if (state == PM_SUSPEND_FREEZE)
freeze_begin();
#ifdef CONFIG_HAS_EARLYSUSPEND
if (suspendsync)
suspend_sys_sync_queue();
#else
if (suspendsync) {
printk(KERN_INFO "PM: Syncing filesystems ... ");
sys_sync();
printk("done.\n");
}
#endif
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state].label);
error = suspend_prepare(state);
if (error)
goto Unlock;
if (suspend_test(TEST_FREEZER))
goto Finish;
pr_debug("PM: Entering %s sleep\n", pm_states[state].label);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
Finish:
pr_debug("PM: Finishing wakeup.\n");
suspend_finish();
Unlock:
mutex_unlock(&pm_mutex);
return error;
}
开发者ID:sombree,项目名称:Hulk-Kernel-V2,代码行数:60,代码来源:suspend.c
示例7: enter_state
/**
* enter_state - Do common work needed to enter system sleep state.
* @state: System sleep state to enter.
*
* Make sure that no one else is trying to put the system into a sleep state.
* Fail if that's not the case. Otherwise, prepare for system suspend, make the
* system enter the given sleep state and clean up after wakeup.
*/
static int enter_state(suspend_state_t state)
{
int error;
trace_suspend_resume(TPS("suspend_enter"), state, true);
if (state == PM_SUSPEND_FREEZE) {
#ifdef CONFIG_PM_DEBUG
if (pm_test_level != TEST_NONE && pm_test_level <= TEST_CPUS) {
pr_warning("PM: Unsupported test mode for suspend to idle,"
"please choose none/freezer/devices/platform.\n");
return -EAGAIN;
}
#endif
} else if (!valid_state(state)) {
return -EINVAL;
}
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
if (state == PM_SUSPEND_FREEZE)
freeze_begin();
trace_suspend_resume(TPS("sync_filesystems"), 0, true);
printk(KERN_INFO "PM: Syncing filesystems ... ");
sys_sync();
printk("done.\n");
trace_suspend_resume(TPS("sync_filesystems"), 0, false);
pr_debug("PM: Preparing system for sleep (%s)\n", pm_states[state]);
error = suspend_prepare(state);
if (error)
goto Unlock;
if (suspend_test(TEST_FREEZER))
goto Finish;
trace_suspend_resume(TPS("suspend_enter"), state, false);
pr_debug("PM: Suspending system (%s)\n", pm_states[state]);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
Finish:
pr_debug("PM: Finishing wakeup.\n");
suspend_finish();
Unlock:
mutex_unlock(&pm_mutex);
return error;
}
开发者ID:Seagate,项目名称:SMR_FS-EXT4,代码行数:57,代码来源:suspend.c
示例8: hibernation_restore
/**
* hibernation_restore - Quiesce devices and restore from a hibernation image.
* @platform_mode: If set, use platform driver to prepare for the transition.
*
* This routine must be called with pm_mutex held. If it is successful, control
* reappears in the restored target kernel in hibernation_snapshot().
*/
int hibernation_restore(int platform_mode)
{
int error;
pm_prepare_console();
suspend_console();
pm_restrict_gfp_mask();
error = dpm_suspend_start(PMSG_QUIESCE);
if (!error) {
error = resume_target_kernel(platform_mode);
dpm_resume_end(PMSG_RECOVER);
}
pm_restore_gfp_mask();
resume_console();
pm_restore_console();
return error;
}
开发者ID:OneOfMany07,项目名称:fjord-kernel,代码行数:24,代码来源:hibernate.c
示例9: suspend_devices_and_enter
/**
* suspend_devices_and_enter - suspend devices and enter the desired system
* sleep state.
* @state: state to enter
*/
int suspend_devices_and_enter(suspend_state_t state)
{
int error;
if (!suspend_ops)
return -ENOSYS;
if (suspend_ops->begin) {
error = suspend_ops->begin(state);
if (error)
goto Close;
}
suspend_console();
pm_restrict_gfp_mask();
suspend_test_start();
error = dpm_suspend_start(PMSG_SUSPEND);
if (error) {
printk(KERN_ERR "PM: Some devices failed to suspend\n");
goto Recover_platform;
}
suspend_test_finish("suspend devices");
if (suspend_test(TEST_DEVICES))
goto Recover_platform;
suspend_enter(state);
Resume_devices:
suspend_test_start();
dpm_resume_end(PMSG_RESUME);
ktime_resume_endtime=ktime_get();
printk(KERN_ERR "<POWER>resume6[peripheral resume]take %llu ns\n",ktime_to_ns(ktime_sub(ktime_resume_endtime, ktime_resume_fromtime)));
ktime_resume_fromtime=ktime_resume_endtime;
suspend_test_finish("resume devices");
pm_restore_gfp_mask();
resume_console();
Close:
if (suspend_ops->end)
suspend_ops->end();
return error;
Recover_platform:
if (suspend_ops->recover)
suspend_ops->recover();
goto Resume_devices;
}
开发者ID:Stepanowegor,项目名称:kernel_dell_streak7,代码行数:50,代码来源:suspend.c
示例10: enter_state
/**
* enter_state - Do common work needed to enter system sleep state.
* @state: System sleep state to enter.
*
* Make sure that no one else is trying to put the system into a sleep state.
* Fail if that's not the case. Otherwise, prepare for system suspend, make the
* system enter the given sleep state and clean up after wakeup.
*/
static int enter_state(suspend_state_t state)
{
int error;
if (!valid_state(state))
return -ENODEV;
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
if (state == PM_SUSPEND_FREEZE)
freeze_begin();
#ifndef CONFIG_ARCH_HI3630
printk(KERN_INFO "PM: Syncing filesystems ... ");
sys_sync();
printk("done.\n");
#else
hisi_sys_sync_queue();
#endif
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
error = suspend_prepare(state);
if (error)
goto Unlock;
if (suspend_test(TEST_FREEZER))
goto Finish;
pr_debug("PM: Entering %s sleep\n", pm_states[state]);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
Finish:
pr_debug("PM: Finishing wakeup.\n");
suspend_finish();
Unlock:
mutex_unlock(&pm_mutex);
return error;
}
开发者ID:herryfan,项目名称:kernel-huawei-h60,代码行数:53,代码来源:suspend.c
示例11: enter_state
/**
* enter_state - Do common work needed to enter system sleep state.
* @state: System sleep state to enter.
*
* Make sure that no one else is trying to put the system into a sleep state.
* Fail if that's not the case. Otherwise, prepare for system suspend, make the
* system enter the given sleep state and clean up after wakeup.
*/
static int enter_state(suspend_state_t state)
{
int error;
if (!valid_state(state))
return -ENODEV;
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
if (state == PM_SUSPEND_FREEZE)
freeze_begin();
printk(KERN_INFO "PM: Syncing filesystems ... ");
sys_sync();
printk("done.\n");
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
error = suspend_prepare(state);
if (error)
goto Unlock;
if (suspend_test(TEST_FREEZER))
goto Finish;
pr_debug("PM: Entering %s sleep\n", pm_states[state]);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
Finish:
pr_debug("PM: Finishing wakeup.\n");
#ifdef CONFIG_MACH_LGE
start_monitor_blocking(suspend_monitor_id,
jiffies + usecs_to_jiffies(3000000));
#endif
suspend_finish();
#ifdef CONFIG_MACH_LGE
end_monitor_blocking(suspend_monitor_id);
#endif
Unlock:
mutex_unlock(&pm_mutex);
return error;
}
开发者ID:AbdulrahmanAmir,项目名称:Dorimanx-LG-G2-D802-Kernel,代码行数:52,代码来源:suspend.c
示例12: suspend_devices_and_enter
/**
* suspend_devices_and_enter - suspend devices and enter the desired system
* sleep state.
* @state: state to enter
*/
int suspend_devices_and_enter(suspend_state_t state)
{
int error;
if (!suspend_ops)
return -ENOSYS;
trace_machine_suspend(state);
if (suspend_ops->begin) {
error = suspend_ops->begin(state);
if (error)
goto Close;
}
suspend_console();
pm_restrict_gfp_mask();
suspend_test_start();
error = dpm_suspend_start(PMSG_SUSPEND);
if (error) {
printk(KERN_ERR "PM: Some devices failed to suspend\n");
goto Recover_platform;
}
suspend_test_finish("suspend devices");
if (suspend_test(TEST_DEVICES))
goto Recover_platform;
suspend_enter(state);
Resume_devices:
suspend_test_start();
dpm_resume_end(PMSG_RESUME);
suspend_test_finish("resume devices");
pm_restore_gfp_mask();
resume_console();
Close:
if (suspend_ops->end)
suspend_ops->end();
trace_machine_suspend(PWR_EVENT_EXIT);
return error;
Recover_platform:
if (suspend_ops->recover)
suspend_ops->recover();
goto Resume_devices;
}
开发者ID:AdiPat,项目名称:android_kernel_htc_pico,代码行数:49,代码来源:suspend.c
示例13: enter_state
/**
* enter_state - Do common work of entering low-power state.
* @state: pm_state structure for state we're entering.
*
* Make sure we're the only ones trying to enter a sleep state. Fail
* if someone has beat us to it, since we don't want anything weird to
* happen when we wake up.
* Then, do the setup for suspend, enter the state, and cleaup (after
* we've woken up).
*/
int enter_state(suspend_state_t state)
{
int error;
if (!valid_state(state))
return -ENODEV;
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
printk(KERN_INFO "PM: Syncing filesystems ... ");
sys_sync();
printk("done.\n");
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
error = suspend_prepare();
if (error)
goto Unlock;
if (suspend_test(TEST_FREEZER))
goto Finish;
meson_lock_min_cpufreq(336000);
pr_debug("PM: Entering %s sleep\n", pm_states[state]);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
meson_lock_min_cpufreq(0);
Finish:
pr_debug("PM: Finishing wakeup.\n");
suspend_finish();
Unlock:
mutex_unlock(&pm_mutex);
#ifdef CONFIG_SUSPEND_WATCHDOG
extern void disable_watchdog(void);
disable_watchdog();
#endif
return error;
}
开发者ID:abazad,项目名称:7300-kern,代码行数:51,代码来源:suspend.c
示例14: enter_state
/**
* enter_state - Do common work of entering low-power state.
* @state: pm_state structure for state we're entering.
*
* Make sure we're the only ones trying to enter a sleep state. Fail
* if someone has beat us to it, since we don't want anything weird to
* happen when we wake up.
* Then, do the setup for suspend, enter the state, and cleaup (after
* we've woken up).
*/
int enter_state(suspend_state_t state)
{
int error;
if (!valid_state(state))
return -ENODEV;
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
#ifdef CONFIG_MSM_SM_EVENT
sm_set_system_state (SM_STATE_SUSPEND);
sm_add_event(SM_POWER_EVENT | SM_POWER_EVENT_SUSPEND, SM_EVENT_START, 0, NULL, 0);
#endif
suspend_sys_sync_queue();
pr_info("PM: Preparing system for %s sleep\n", pm_states[state]);
error = suspend_prepare();
if (error)
goto Unlock;
if (suspend_test(TEST_FREEZER))
goto Finish;
pr_info("PM: Entering %s sleep\n", pm_states[state]);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
Finish:
pr_info("PM: Finishing wakeup.\n");
suspend_finish();
Unlock:
mutex_unlock(&pm_mutex);
#ifdef CONFIG_MSM_SM_EVENT
sm_add_event(SM_POWER_EVENT | SM_POWER_EVENT_RESUME, SM_EVENT_END, 0, NULL, 0);
#endif
return error;
}
开发者ID:emreharbutoglu,项目名称:gp-peak-kernel,代码行数:50,代码来源:suspend.c
示例15: enter_state
int enter_state(suspend_state_t state)
{
int error;
if (!valid_state(state))
return -ENODEV;
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
#if 0//ndef PA_THERM
#if !defined(CONFIG_MACH_APQ8064_J1D) && !defined(CONFIG_MACH_APQ8064_J1KD)
pm8xxx_adc_unconfigure();
#endif
#endif
suspend_sys_sync_queue();
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
error = suspend_prepare();
if (error)
goto Unlock;
if (suspend_test(TEST_FREEZER))
goto Finish;
pr_debug("PM: Entering %s sleep\n", pm_states[state]);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
Finish:
pr_debug("PM: Finishing wakeup.\n");
suspend_finish();
Unlock:
mutex_unlock(&pm_mutex);
return error;
}
开发者ID:regit66,项目名称:android_kernel_lge_geehrc,代码行数:38,代码来源:suspend.c
示例16: enter_state
int enter_state(suspend_state_t state)
{
int error;
int dock=0;
int retries=3;
if (!valid_state(state))
return -ENODEV;
if (!mutex_trylock(&pm_mutex))
return -EBUSY;
printk(KERN_INFO "PM: Syncing filesystems ... ");
sys_sync();
printk("done.\n");
#ifdef CONFIG_ASUSEC
if (gpio_get_value(TEGRA_GPIO_PX5)==0){
dock=1;
hub_suspended=0;
//// nousb=1;
// printk("mutex+\n");
// mutex_lock(&usb_mutex);
if (nousb==1) {
printk("usb wait1\n");
msleep(500);
}
asusec_close_keyboard();
//// asusec_suspend_hub_callback2();
/* while (!hub_suspended) {
asusec_suspend_hub_callback();
if (retries-- == 0)
break;
if (!hub_suspended) {
stop_dock();
msleep(500);
asusec_resume(0);
msleep(500);
// printk("try to restart asusec\n");
// reload_asusec();
}
}
*/
// printk("mutex-\n");
// mutex_unlock(&usb_mutex);
/*
if (!hub_suspended) {
stop_dock();
printk("Dock problem\n");
if (failed_dock < 3) {
printk("aborted suspend\n");
failed_dock++;
asusec_resume(0);
error=999;
// nousb=0;
goto Unlock;
}
}
*/
// nousb=0;
failed_dock=0;
msleep(2000);
// cpu_down(1);
}
#endif
pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]);
error = suspend_prepare();
if (error) {
if (dock==1) {
asusec_resume(0);
}
goto Unlock;
}
if (suspend_test(TEST_FREEZER))
goto Finish;
pr_debug("PM: Entering %s sleep\n", pm_states[state]);
pm_restrict_gfp_mask();
error = suspend_devices_and_enter(state);
pm_restore_gfp_mask();
Finish:
pr_debug("PM: Finishing wakeup.\n");
suspend_finish();
Unlock:
// asusec_resume(0);
mutex_unlock(&pm_mutex);
return error;
}
开发者ID:corvusmod,项目名称:kernel_asus_tf101-lumpy,代码行数:90,代码来源:suspend.c
示例17: toi_go_atomic
/**
* toi_go_atomic - do the actual atomic copy/restore
* @state: The state to use for dpm_suspend_start & power_down calls.
* @suspend_time: Whether we're suspending or resuming.
**/
int toi_go_atomic(pm_message_t state, int suspend_time)
{
if (suspend_time) {
if (platform_begin(1)) {
set_abort_result(TOI_PLATFORM_PREP_FAILED);
toi_end_atomic(ATOMIC_STEP_PLATFORM_END, suspend_time, 3);
hib_log("FAILED @line:%d suspend(%d) pm_state(%d)\n", __LINE__,
suspend_time, state.event);
return 1;
}
if (dpm_prepare(PMSG_FREEZE)) {
set_abort_result(TOI_DPM_PREPARE_FAILED);
dpm_complete(PMSG_RECOVER);
toi_end_atomic(ATOMIC_STEP_PLATFORM_END, suspend_time, 3);
hib_log("FAILED @line:%d suspend(%d) pm_state(%d)\n", __LINE__,
suspend_time, state.event);
return 1;
}
}
suspend_console();
ftrace_stop();
pm_restrict_gfp_mask();
if (suspend_time) {
#if 0 /* FIXME: jonathan.jmchen: trick code here to let dpm_suspend succeeded, NEED to find out the root cause!! */
if (events_check_enabled) {
hib_log("play trick here set events_check_enabled(%d) = false!!\n",
events_check_enabled);
events_check_enabled = false;
}
#endif
if (dpm_suspend(state)) {
set_abort_result(TOI_DPM_SUSPEND_FAILED);
toi_end_atomic(ATOMIC_STEP_DEVICE_RESUME, suspend_time, 3);
hib_log("FAILED @line:%d suspend(%d) pm_state(%d) toi_result(0x%#lx)\n",
__LINE__, suspend_time, state.event, toi_result);
return 1;
}
} else {
if (dpm_suspend_start(state)) {
set_abort_result(TOI_DPM_SUSPEND_FAILED);
toi_end_atomic(ATOMIC_STEP_DEVICE_RESUME, suspend_time, 3);
hib_log("FAILED @line:%d suspend(%d) pm_state(%d) toi_result(0x%#lx)\n",
__LINE__, suspend_time, state.event, toi_result);
return 1;
}
}
/* At this point, dpm_suspend_start() has been called, but *not*
* dpm_suspend_noirq(). We *must* dpm_suspend_noirq() now.
* Otherwise, drivers for some devices (e.g. interrupt controllers)
* become desynchronized with the actual state of the hardware
* at resume time, and evil weirdness ensues.
*/
if (dpm_suspend_end(state)) {
set_abort_result(TOI_DEVICE_REFUSED);
toi_end_atomic(ATOMIC_STEP_DEVICE_RESUME, suspend_time, 1);
hib_log("FAILED @line:%d suspend(%d) pm_state(%d) toi_result(0x%#lx)\n", __LINE__,
suspend_time, state.event, toi_result);
return 1;
}
if (suspend_time) {
if (platform_pre_snapshot(1))
set_abort_result(TOI_PRE_SNAPSHOT_FAILED);
} else {
if (platform_pre_restore(1))
set_abort_result(TOI_PRE_RESTORE_FAILED);
}
if (test_result_state(TOI_ABORTED)) {
toi_end_atomic(ATOMIC_STEP_PLATFORM_FINISH, suspend_time, 1);
hib_log("FAILED @line:%d suspend(%d) pm_state(%d) toi_result(0x%#lx)\n", __LINE__,
suspend_time, state.event, toi_result);
return 1;
}
if (test_action_state(TOI_LATE_CPU_HOTPLUG)) {
if (disable_nonboot_cpus()) {
set_abort_result(TOI_CPU_HOTPLUG_FAILED);
toi_end_atomic(ATOMIC_STEP_CPU_HOTPLUG, suspend_time, 1);
hib_log("FAILED @line:%d suspend(%d) pm_state(%d) toi_result(0x%#lx)\n",
__LINE__, suspend_time, state.event, toi_result);
return 1;
}
}
local_irq_disable();
if (syscore_suspend()) {
set_abort_result(TOI_SYSCORE_REFUSED);
toi_end_atomic(ATOMIC_STEP_IRQS, suspend_time, 1);
//.........这里部分代码省略.........
开发者ID:AudioGod,项目名称:MediaTek-HelioX10-Kernel,代码行数:101,代码来源:tuxonice_atomic_copy.c
示例18: __toi_power_down
static void __toi_power_down(int method)
{
int error;
toi_cond_pause(1, test_action_state(TOI_REBOOT) ? "Ready to reboot." :
"Powering down.");
if (test_result_state(TOI_ABORTED))
goto out;
if (test_action_state(TOI_REBOOT))
kernel_restart(NULL);
switch (method) {
case 0:
break;
case 3:
/*
* Re-read the overwritten part of pageset2 to make post-resume
* faster.
*/
if (read_pageset2(1))
panic("Attempt to reload pagedir 2 failed. "
"Try rebooting.");
pm_prepare_console();
error = pm_notifier_call_chain(PM_SUSPEND_PREPARE);
if (!error) {
pm_restore_gfp_mask();
error = suspend_devices_and_enter(PM_SUSPEND_MEM);
pm_restrict_gfp_mask();
if (!error)
did_suspend_to_both = 1;
}
pm_notifier_call_chain(PM_POST_SUSPEND);
pm_restore_console();
// jonathan.jmchen: FIXME, Create API to add another wakeup source to power down,
// if system is idle after xxx (e.g., 5 min) without user interaction!!
/* Success - we're now post-resume-from-ram */
if (did_suspend_to_both)
return;
/* Failed to suspend to ram - do normal power off */
break;
case 4:
/*
* If succeeds, doesn't return. If fails, do a simple
* powerdown.
*/
hibernation_platform_enter();
break;
case 5:
/* Historic entry only now */
break;
}
if (method && method != 5)
toi_cond_pause(1,
"Falling back to alternate power off method.");
if (test_result_state(TOI_ABORTED))
goto out;
kernel_power_off();
kernel_halt();
toi_cond_pause(1, "Powerdown failed.");
while (1)
cpu_relax();
out:
if (read_pageset2(1))
panic("Attempt to reload pagedir 2 failed. Try rebooting.");
return;
}
开发者ID:agrloki,项目名称:android_kernel_ousheng_V9,代码行数:77,代码来源:tuxonice_power_off.c
示例19: hibernation_snapshot
/**
* hibernation_snapshot - Quiesce devices and create a hibernation image.
* @platform_mode: If set, use platform driver to prepare for the transition.
*
* This routine must be called with pm_mutex held.
*/
int hibernation_snapshot(int platform_mode)
{
pm_message_t msg;
int error;
pm_suspend_clear_flags();
error = platform_begin(platform_mode);
if (error)
goto Close;
/* Preallocate image memory before shutting down devices. */
error = hibernate_preallocate_memory();
if (error)
goto Close;
error = freeze_kernel_threads();
if (error)
goto Cleanup;
if (hibernation_test(TEST_FREEZER)) {
/*
* Indicate to the caller that we are returning due to a
* successful freezer test.
*/
freezer_test_done = true;
goto Thaw;
}
error = dpm_prepare(PMSG_FREEZE);
if (error) {
dpm_complete(PMSG_RECOVER);
goto Thaw;
}
suspend_console();
pm_restrict_gfp_mask();
error = dpm_suspend(PMSG_FREEZE);
if (error || hibernation_test(TEST_DEVICES))
platform_recover(platform_mode);
else
error = create_image(platform_mode);
/*
* In the case that we call create_image() above, the control
* returns here (1) after the image has been created or the
* image creation has failed and (2) after a successful restore.
*/
/* We may need to release the preallocated image pages here. */
if (error || !in_suspend)
swsusp_free();
msg = in_suspend ? (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE;
dpm_resume(msg);
if (error || !in_suspend)
pm_restore_gfp_mask();
resume_console();
dpm_complete(msg);
Close:
platform_end(platform_mode);
return error;
Thaw:
thaw_kernel_threads();
Cleanup:
swsusp_free();
goto Close;
}
开发者ID:mdamt,项目名称:linux,代码行数:80,代码来源:hibernate.c
示例20: hibernation_snapshot
/**
* hibernation_snapshot - Quiesce devices and create a hibernation image.
* @platform_mode: If set, use platform driver to prepare for the transition.
*
* This routine must be called with pm_mutex held.
*/
int hibernation_snapshot(int platform_mode)
{
pm_message_t msg = PMSG_RECOVER;
int error;
error = platform_begin(platform_mode);
if (error)
goto Close;
/* Preallocate image memory before shutting down devices. */
error = hibernate_preallocate_memory();
if (error)
goto Close;
error = freeze_kernel_threads();
if (error)
goto Close;
if (hibernation_test(TEST_FREEZER) ||
hibernation_testmode(HIBERNATION_TESTPROC)) {
/*
* Indicate to the caller that we are returning due to a
* successful freezer test.
*/
freezer_test_done = true;
goto Close;
}
error = dpm_prepare(PMSG_FREEZE);
if (error)
goto Complete_devices;
suspend_console();
pm_restrict_gfp_mask();
error = dpm_suspend(PMSG_FREEZE);
if (error)
goto Recover_platform;
if (hibernation_test(TEST_DEVICES))
goto Recover_platform;
error = create_image(platform_mode);
/*
* Control returns here (1) after the image has been created or the
* image creation has failed and (2) after a successful restore.
*/
Resume_devices:
/* We may need to release the preallocated image pages here. */
if (error || !in_suspend)
swsusp_free();
msg = in_suspend ? (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE;
dpm_resume(msg);
if (error || !in_suspend)
pm_restore_gfp_mask();
resume_console();
Complete_devices:
dpm_complete(msg);
Close:
platform_end(platform_mode);
return error;
Recover_platform:
platform_recover(platform_mode);
goto Resume_devices;
}
开发者ID:vimiii,项目名称:linux,代码行数:78,代码来源:hibernate.c
注:本文中的pm_restrict_gfp_mask函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论