您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ valid_state函数代码示例

51自学网 2021-06-03 09:32:46
  C++
这篇教程C++ valid_state函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中valid_state函数的典型用法代码示例。如果您正苦于以下问题:C++ valid_state函数的具体用法?C++ valid_state怎么用?C++ valid_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了valid_state函数的23个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: 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;	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:happyhere,项目名称:802Xtreem,代码行数:39,


示例2: state_show

static ssize_t state_show(struct kobject *kobj, struct kobj_attribute *attr,			  char *buf){	char *s = buf;#ifdef CONFIG_SUSPEND#if 0	// deleted by peres for test	int i;	for (i = 0; i < PM_SUSPEND_MAX; i++) {		if (pm_states[i] && valid_state(i))			s += sprintf(s,"%s ", pm_states[i]);	}#else	switch(global_state) {		case PM_SUSPEND_ON :			s += sprintf(s,"%s ", pm_states[PM_SUSPEND_ON]);			break;		case PM_SUSPEND_MEM :			s += sprintf(s,"%s ", pm_states[PM_SUSPEND_MEM]);			break;	}#endif#endif#ifdef CONFIG_HIBERNATION	s += sprintf(s, "%s/n", "disk");#else	if (s != buf)		/* convert the last space to a newline */		*(s-1) = '/n';#endif	return (s - buf);}
开发者ID:SamdroidMod,项目名称:spica_kernel_29,代码行数:31,


示例3: 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;	pr_debug("PM: Entering %s sleep/n", pm_states[state]);	error = suspend_devices_and_enter(state); Finish:	pr_debug("PM: Finishing wakeup./n");	suspend_finish(); Unlock:	mutex_unlock(&pm_mutex);	return error;}
开发者ID:AbheekG,项目名称:XIA-for-Linux,代码行数:42,


示例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,


示例5: suspend_set_ops

/** * suspend_set_ops - Set the global suspend method table. * @ops: Suspend operations to use. */void suspend_set_ops(const struct platform_suspend_ops *ops){	lock_system_sleep();	suspend_ops = ops;	if (valid_state(PM_SUSPEND_STANDBY)) {		mem_sleep_states[PM_SUSPEND_STANDBY] = mem_sleep_labels[PM_SUSPEND_STANDBY];		pm_states[PM_SUSPEND_STANDBY] = pm_labels[PM_SUSPEND_STANDBY];		if (mem_sleep_default == PM_SUSPEND_STANDBY)			mem_sleep_current = PM_SUSPEND_STANDBY;	}	if (valid_state(PM_SUSPEND_MEM)) {		mem_sleep_states[PM_SUSPEND_MEM] = mem_sleep_labels[PM_SUSPEND_MEM];		if (mem_sleep_default >= PM_SUSPEND_MEM)			mem_sleep_current = PM_SUSPEND_MEM;	}	unlock_system_sleep();}
开发者ID:guribe94,项目名称:linux,代码行数:24,


示例6: state_store

static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,			   const char *buf, size_t n){#ifdef CONFIG_SUSPEND#ifdef CONFIG_EARLYSUSPEND	suspend_state_t state = PM_SUSPEND_ON;#else	suspend_state_t state = PM_SUSPEND_STANDBY;#endif	const char * const *s;#endif	char *p;	int len;	int error = -EINVAL;	p = memchr(buf, '/n', n);	len = p ? p - buf : n;	/* First, check if we are requested to hibernate */	if (len == 4 && !strncmp(buf, "disk", len)) {		error = hibernate();  goto Exit;	}#if defined(CONFIG_MP_MSTAR_STR_BASE)    // for mstar str, we skip wakelock    // and earlysuspend/lateresume to speedup suspend    if (len == 4 && !strncmp(buf, "mstr", len)) {        state = PM_SUSPEND_MEM;        pm_is_mstar_str = 1;        error = enter_state(state);        pm_is_mstar_str = 0;        goto Exit;    }#endif#ifdef CONFIG_SUSPEND	for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))			break;	}	if (state < PM_SUSPEND_MAX && *s)#ifdef CONFIG_EARLYSUSPEND		if (state == PM_SUSPEND_ON || valid_state(state)) {			error = 0;			request_suspend_state(state);		}#else		error = enter_state(state);#endif#endif Exit:	return error ? error : n;}
开发者ID:nightcap79,项目名称:kogan-tv-gpl,代码行数:54,


示例7: state_show

static ssize_t state_show(struct kset *kset, char *buf){	int i;	char * s = buf;	for (i = 0; i < PM_SUSPEND_MAX; i++) {		if (pm_states[i] && valid_state(i))			s += sprintf(s,"%s ", pm_states[i]);	}	s += sprintf(s,"/n");	return (s - buf);}
开发者ID:qwerty1023,项目名称:wive-rtnl-firmware,代码行数:12,


示例8: suspend_set_ops

/** * suspend_set_ops - Set the global suspend method table. * @ops: Suspend operations to use. */void suspend_set_ops(const struct platform_suspend_ops *ops){	suspend_state_t i;	lock_system_sleep();	suspend_ops = ops;	for (i = PM_SUSPEND_STANDBY; i <= PM_SUSPEND_MEM; i++)		pm_states[i].state = valid_state(i) ? i : 0;	unlock_system_sleep();}
开发者ID:sombree,项目名称:Hulk-Kernel-V2,代码行数:16,


示例9: 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,


示例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 (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,


示例11: state_store

static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,			   const char *buf, size_t n){#ifdef CONFIG_SUSPEND#ifdef CONFIG_EARLYSUSPEND	suspend_state_t state = PM_SUSPEND_ON;#else	suspend_state_t state = PM_SUSPEND_STANDBY;#endif	const char * const *s;#endif	char *p;	int len;	int error = -EINVAL;	p = memchr(buf, '/n', n);	len = p ? p - buf : n;	/* First, check if we are requested to hibernate */	if (len == 4 && !strncmp(buf, "disk", len)) {		printk(KERN_ERR "entering hibernate");		error = hibernate();  goto Exit;	}#ifdef CONFIG_SUSPEND	for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))			break;	}	printk(KERN_ERR "entering sleep state = %d/n", state);	if (state < PM_SUSPEND_MAX && *s)	{#ifdef CONFIG_EARLYSUSPEND		if (state == PM_SUSPEND_ON || valid_state(state)) {			error = 0;			request_suspend_state(state);		} else {			printk(KERN_ERR "not valid state with state = %d", state);		}#else		error = enter_state(state);#endif	}#endif Exit:	return error ? error : n;}
开发者ID:faizauthar12,项目名称:Hyper_kernel,代码行数:50,


示例12: 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,


示例13: state_store

static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,			   const char *buf, size_t n){#ifdef CONFIG_SUSPEND#ifdef CONFIG_EARLYSUSPEND	suspend_state_t state = PM_SUSPEND_ON;#else	suspend_state_t state = PM_SUSPEND_STANDBY;#endif	const char * const *s;#endif	char *p;	int len;	int error = -EINVAL;	p = memchr(buf, '/n', n);	len = p ? p - buf : n;	/* First, check if we are requested to hibernate */	if (len == 4 && !strncmp(buf, "disk", len)) {		error = hibernate();  goto Exit;	}#ifdef CONFIG_SUSPEND	for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {		if (*s && len == strlen(*s) && !strncmp(buf, *s, len))			break;	}	if (state < PM_SUSPEND_MAX && *s) {     /*LGE_CHANGE : [email
C++ valid_user_regs函数代码示例
C++ val_to_str_const函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。