本文整理汇总了C++中param_set_bool函数的典型用法代码示例。如果您正苦于以下问题:C++ param_set_bool函数的具体用法?C++ param_set_bool怎么用?C++ param_set_bool使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了param_set_bool函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: anx7808_enable_irq
static int anx7808_enable_irq(const char *val, const struct kernel_param *kp)
{
int ret;
int old_val = irq_enabled;
if (!the_chip)
return -ENODEV;
ret = param_set_bool(val, kp);
if (ret) {
pr_err("failed to enable slimpot\n");
return ret;
}
if (irq_enabled) {
if (old_val) {
disable_irq(the_chip->client->irq);
sp_tx_power_down_and_init();
anx7808_unvote_usb_clk(the_chip);
}
anx7808_cbl_det_isr(the_chip->client->irq, the_chip);
enable_irq(the_chip->client->irq);
}
return 0;
}
示例2: bluetooth_power_param_set
static int bluetooth_power_param_set(const char *val, struct kernel_param *kp)
{
int ret;
printk(KERN_DEBUG
"%s: previous power_state=%d\n",
__func__, bluetooth_power_state);
/* lock change of state and reference */
spin_lock(&bt_power_lock);
ret = param_set_bool(val, kp);
if (power_control) {
if (!ret)
ret = (*power_control)(bluetooth_power_state);
else
printk(KERN_ERR "%s param set bool failed (%d)\n",
__func__, ret);
} else {
printk(KERN_INFO
"%s: deferring power switch until probe\n",
__func__);
}
spin_unlock(&bt_power_lock);
printk(KERN_INFO
"%s: current power_state=%d\n",
__func__, bluetooth_power_state);
return ret;
}
示例3: hp_state_set
static int hp_state_set(const char *arg, const struct kernel_param *kp)
{
int ret = 0;
int old_state;
if (!tegra3_cpu_lock)
return ret;
mutex_lock(tegra3_cpu_lock);
old_state = hp_state;
ret = param_set_bool(arg, kp); /* set idle or disabled only */
if (ret == 0) {
if ((hp_state == TEGRA_HP_DISABLED) &&
(old_state != TEGRA_HP_DISABLED))
pr_info("Tegra auto-hotplug disabled\n");
else if (hp_state != TEGRA_HP_DISABLED) {
if (old_state == TEGRA_HP_DISABLED) {
pr_info("Tegra auto-hotplug enabled\n");
hp_init_stats();
}
/* catch-up with governor target speed */
tegra_cpu_set_speed_cap(NULL);
}
} else
pr_warn("%s: unable to set tegra hotplug state %s\n",
__func__, arg);
mutex_unlock(tegra3_cpu_lock);
return ret;
}
示例4: set_subscribe_inform_info
static int set_subscribe_inform_info(const char *val, struct kernel_param *kp)
{
int ret;
ret = param_set_bool(val, kp);
if (ret)
return ret;
return do_refresh(val, kp);
}
示例5: param_set_invbool
int param_set_invbool(const char *val, struct kernel_param *kp)
{
int boolval, ret;
struct kernel_param dummy = { .arg = &boolval };
ret = param_set_bool(val, &dummy);
if (ret == 0)
*(int *)kp->arg = !boolval;
return ret;
}
示例6: vdd_rstr_en_store
static ssize_t vdd_rstr_en_store(struct kobject *kobj,
struct kobj_attribute *attr, const char *buf, size_t count)
{
int ret = 0;
int i = 0;
uint8_t en_cnt = 0;
uint8_t dis_cnt = 0;
uint32_t val = 0;
struct kernel_param kp;
struct vdd_rstr_enable *en = VDD_RSTR_ENABLE_FROM_ATTRIBS(attr);
mutex_lock(&vdd_rstr_mutex);
kp.arg = &val;
ret = param_set_bool(buf, &kp);
if (ret) {
pr_err("Invalid input %s for enabled\n", buf);
goto done_vdd_rstr_en;
}
if ((val == 0) && (en->enabled == 0))
goto done_vdd_rstr_en;
for (i = 0; i < rails_cnt; i++) {
if (rails[i].freq_req == 1 && freq_table_get)
ret = vdd_restriction_apply_freq(&rails[i],
(val) ? 0 : -1);
else
ret = vdd_restriction_apply_voltage(&rails[i],
(val) ? 0 : -1);
/*
* Even if fail to set one rail, still try to set the
* others. Continue the loop
*/
if (ret)
pr_err("Set vdd restriction for %s failed\n",
rails[i].name);
else {
if (val)
en_cnt++;
else
dis_cnt++;
}
}
/* As long as one rail is enabled, vdd rstr is enabled */
if (val && en_cnt)
en->enabled = 1;
else if (!val && (dis_cnt == rails_cnt))
en->enabled = 0;
done_vdd_rstr_en:
mutex_unlock(&vdd_rstr_mutex);
return count;
}
示例7: bluetooth_power_param_set
static int bluetooth_power_param_set(const char *val, struct kernel_param *kp)
{
int ret;
printk(KERN_DEBUG
"%s: previous power_state=%d\n",
__func__, bluetooth_power_state);
/* lock change of state and reference */
spin_lock(&bt_power_lock);
ret = param_set_bool(val, kp);
if (power_control) {
if (!ret){
ret = (*power_control)(bluetooth_power_state);
printk(KERN_ERR "%s: bluetooth power control, return = (%d)\n",
__func__, ret);
}
else{
printk(KERN_ERR "%s param set bool failed (%d)\n",
__func__, ret);
}
} else {
printk(KERN_INFO
"%s: deferring power switch until probe\n",
__func__);
}
spin_unlock(&bt_power_lock);
printk(KERN_INFO
"%s: current power_state=%d\n",
__func__, bluetooth_power_state);
if(bluetooth_power_state == 0){
hsuart_power(0);
gpio_set_value(16,0);
msleep(105);
gpio_set_value(48,0);
}
else{
gpio_set_value(16,0);
msleep(1);
gpio_set_value(48,1);
msleep(105);
gpio_set_value(16,1);
}
printk(" ***** ----------- --------- GPIO 48 = %d\n",gpio_get_value(48));
printk(" ***** ----------- --------- GPIO 16 = %d\n",gpio_get_value(16));
return ret;
}
示例8: set_enabled
static int set_enabled(const char *val, const struct kernel_param *kp)
{
int rv = param_set_bool(val, kp);
if (rv)
return rv;
if (otgwl_xceiv)
otgwl_handle_event(otgwl_xceiv->last_event);
return 0;
}
示例9: lp2_in_idle_set
static int lp2_in_idle_set(const char *arg, const struct kernel_param *kp)
{
#ifdef CONFIG_PM_SLEEP
int ret;
/* If LP2 in idle is permanently disabled it can't be re-enabled. */
if (lp2_in_idle_modifiable) {
ret = param_set_bool(arg, kp);
return ret;
}
#endif
return -ENODEV;
}
示例10: param_set_invbool
/* This one must be bool. */
int param_set_invbool(const char *val, const struct kernel_param *kp)
{
int ret;
bool boolval;
struct kernel_param dummy;
dummy.arg = &boolval;
dummy.flags = KPARAM_ISBOOL;
ret = param_set_bool(val, &dummy);
if (ret == 0)
*(bool *)kp->arg = !boolval;
return ret;
}
示例11: param_set_ramdump_enable
/* Returns 0, or -errno. arg is in kp->arg. */
static int param_set_ramdump_enable(const char *val,
const struct kernel_param *kp)
{
int ret = param_set_bool(val, kp);
printk(KERN_INFO "%s ramdump_enable = %d\n", __func__, ramdump_enable);
if (ramdump_enable)
cdebugger_set_upload_magic(0xDEAFABCD);
else
cdebugger_set_upload_magic(0);
return ret;
}
示例12: enable_pp_set
static int enable_pp_set(const char *arg, const struct kernel_param *kp)
{
int total_pages, available_pages;
param_set_bool(arg, kp);
if (!enable_pp) {
shrink_page_pools(&total_pages, &available_pages);
pr_info("disabled page pools and released pages, "
"total_pages_released=%d, free_pages_available=%d",
total_pages, available_pages);
}
return 0;
}
示例13: tegra_dvfs_disable_cpu_set
int tegra_dvfs_disable_cpu_set(const char *arg, const struct kernel_param *kp)
{
int ret;
ret = param_set_bool(arg, kp);
if (ret)
return ret;
if (tegra_dvfs_cpu_disabled)
tegra_dvfs_rail_disable(&tegra3_dvfs_rail_vdd_cpu);
else
tegra_dvfs_rail_enable(&tegra3_dvfs_rail_vdd_cpu);
return 0;
}
示例14: enable_fast_hotplug
static int enable_fast_hotplug(const char *val, const struct kernel_param *kp){
int cpu;
int ret = param_set_bool(val, kp);
if(!fast_hotplug_enabled){
pr_info(HOTPLUG_INFO_TAG"Fast hotplug disabled\n");
mutex_lock(&mutex);
flush_workqueue(hotplug_wq);
for_each_possible_cpu(cpu){
if(cpu == 0)
continue;
cpu_up(cpu);
}
is_sleeping = true;
mutex_unlock(&mutex);
} else {
示例15: shrink_set
static int shrink_set(const char *arg, const struct kernel_param *kp)
{
int cpu = smp_processor_id();
unsigned long long t1, t2;
int total_pages, available_pages;
param_set_bool(arg, kp);
if (shrink_pp) {
t1 = cpu_clock(cpu);
shrink_page_pools(&total_pages, &available_pages);
t2 = cpu_clock(cpu);
pr_info("shrink page pools: time=%lldns, "
"total_pages_released=%d, free_pages_available=%d",
t2-t1, total_pages, available_pages);
}
return 0;
}