コード例 #1
0
ファイル: swsusp.c プロジェクト: xricson/knoppix
void do_magic_suspend_2(void)
{
	int is_problem;
	read_swapfiles();
	is_problem = suspend_prepare_image();
	spin_unlock_irq(&suspend_pagedir_lock);
	if (!is_problem) {
		kernel_fpu_end();	/* save_processor_state() does kernel_fpu_begin, and we need to revert it in order to pass in_atomic() checks */
		BUG_ON(in_atomic());
		suspend_save_image();
		suspend_power_down();	/* FIXME: if suspend_power_down is commented out, console is lost after few suspends ?! */
	}

	printk(KERN_EMERG "%sSuspend failed, trying to recover...\n", name_suspend);
	MDELAY(1000); /* So user can wait and report us messages if armageddon comes :-) */

	barrier();
	mb();
	spin_lock_irq(&suspend_pagedir_lock);	/* Done to disable interrupts */ 
	mdelay(1000);

	free_pages((unsigned long) pagedir_nosave, pagedir_order);
	spin_unlock_irq(&suspend_pagedir_lock);
	mark_swapfiles(((swp_entry_t) {0}), MARK_SWAP_RESUME);
}
コード例 #2
0
ファイル: swsusp.c プロジェクト: Antonio-Zhou/Linux-2.6.11
asmlinkage int swsusp_save(void)
{
	int error = 0;

	if ((error = swsusp_swap_check())) {
		printk(KERN_ERR "swsusp: FATAL: cannot find swap device, try "
				"swapon -a!\n");
		return error;
	}
	return suspend_prepare_image();
}