kernels/linux-2.4.0/drivers/acpi/sys.c
/*
 * Enter system sleep state and wait for completion
 */
Enter system sleep state and wait for completion
Enter system sleep state and wait for completion
int
acpi_enter_sx(acpi_sstate_t state)
{
	struct acpi_enter_sx_ctx ctx;
	DECLARE_WAITQUEUE(wait, current);
	int ret = 0;
	if ((STRNCMP(acpi_fadt.header.signature, ACPI_FADT_SIGNATURE, ACPI_SIG_LEN) != 0)
	    || acpi_slptyp[state] == ACPI_INVALID)
		return -EINVAL;
	init_waitqueue_head(&ctx.wait);
	ctx.state = state;
	set_current_state(TASK_INTERRUPTIBLE);
	add_wait_queue(&ctx.wait, &wait);
	if (acpi_os_queue_for_execution(0, acpi_enter_sx_async, &ctx))
		ret = -1;
	if (!ret)
		schedule();
	set_current_state(TASK_RUNNING);
	remove_wait_queue(&ctx.wait, &wait);
	if (!ret && signal_pending(current))
		ret = -ERESTARTSYS;
	return ret;
}
int acpi_enter_sx ( acpi_sstate_t state ) { struct acpi_enter_sx_ctx ctx ; DECLARE_WAITQUEUE ( wait , current ) ; int ret = 0 ; if ( ( STRNCMP ( acpi_fadt . header . signature , ACPI_FADT_SIGNATURE , ACPI_SIG_LEN ) != 0 ) || acpi_slptyp [ state ] == ACPI_INVALID ) return - EINVAL ; init_waitqueue_head ( & ctx . wait ) ; ctx . state = state ; set_current_state ( TASK_INTERRUPTIBLE ) ; add_wait_queue ( & ctx . wait , & wait ) ; if ( acpi_os_queue_for_execution ( 0 , acpi_enter_sx_async , & ctx ) ) ret = -1 ; if ( ! ret ) schedule ( ) ; set_current_state ( TASK_RUNNING ) ; remove_wait_queue ( & ctx . wait , & wait ) ; if ( ! ret && signal_pending ( current ) ) ret = - ERESTARTSYS ; return ret ; }
Enter system sleep state and wait for completion
Enter system sleep state and wait for completion