本文整理汇总了C++中pm_autosleep_state函数的典型用法代码示例。如果您正苦于以下问题:C++ pm_autosleep_state函数的具体用法?C++ pm_autosleep_state怎么用?C++ pm_autosleep_state使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pm_autosleep_state函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: state_store
static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t n)
{
suspend_state_t state;
int error;
error = pm_autosleep_lock();
if (error)
return error;
if (pm_autosleep_state() > PM_SUSPEND_ON) {
error = -EBUSY;
goto out;
}
state = decode_state(buf, n);
if (state < PM_SUSPEND_MAX)
error = pm_suspend(state);
else if (state == PM_SUSPEND_MAX)
error = hibernate();
else
error = -EINVAL;
out:
pm_autosleep_unlock();
return error ? error : n;
}
开发者ID:qkdang,项目名称:m462,代码行数:27,代码来源:main.c
示例2: wakeup_count_store
static ssize_t wakeup_count_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t n)
{
unsigned int val;
int error;
error = pm_autosleep_lock();
if (error)
return error;
if (pm_autosleep_state() > PM_SUSPEND_ON) {
error = -EBUSY;
goto out;
}
error = -EINVAL;
if (sscanf(buf, "%u", &val) == 1) {
if (pm_save_wakeup_count(val))
error = n;
}
out:
pm_autosleep_unlock();
return error;
}
开发者ID:qkdang,项目名称:m462,代码行数:26,代码来源:main.c
示例3: state_store
static ssize_t state_store(struct kobject *kobj, struct kobj_attribute *attr,
const char *buf, size_t n)
{
suspend_state_t state;
struct timespec ts_entry, ts_exit;
u64 elapsed_msecs64;
u32 elapsed_msecs32;
int error;
error = pm_autosleep_lock();
if (error)
return error;
if (pm_autosleep_state() > PM_SUSPEND_ON) {
error = -EBUSY;
goto out;
}
state = decode_state(buf, n);
if (state < PM_SUSPEND_MAX) {
/*
* We want to prevent system from frequent periodic wake-ups
* when sleeping time is less or equival certain interval.
* It's done in order to save power in certain cases, one of
* the examples is GPS tracking, but not only.
*/
getnstimeofday(&ts_entry);
error = pm_suspend(state);
getnstimeofday(&ts_exit);
elapsed_msecs64 = timespec_to_ns(&ts_exit) -
timespec_to_ns(&ts_entry);
do_div(elapsed_msecs64, NSEC_PER_MSEC);
elapsed_msecs32 = elapsed_msecs64;
if (elapsed_msecs32 <= SBO_SLEEP_MSEC) {
if (suspend_short_count == SBO_CNT)
suspend_backoff();
else
suspend_short_count++;
} else {
suspend_short_count = 0;
}
} else if (state == PM_SUSPEND_MAX)
error = hibernate();
else
error = -EINVAL;
out:
pm_autosleep_unlock();
return error ? error : n;
}
开发者ID:GustavoRD78,项目名称:78Kernel-6.0.1-23.5.A.0.570,代码行数:52,代码来源:main.c
示例4: autosleep_show
static ssize_t autosleep_show(struct kobject *kobj,
struct kobj_attribute *attr,
char *buf)
{
suspend_state_t state = pm_autosleep_state();
if (state == PM_SUSPEND_ON)
return sprintf(buf, "off\n");
#ifdef CONFIG_SUSPEND
if (state < PM_SUSPEND_MAX)
return sprintf(buf, "%s\n", valid_state(state) ?
pm_states[state] : "error");
#endif
#ifdef CONFIG_HIBERNATION
return sprintf(buf, "disk\n");
#else
return sprintf(buf, "error");
#endif
}
开发者ID:qkdang,项目名称:m462,代码行数:20,代码来源:main.c
注:本文中的pm_autosleep_state函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论