/** * cpufreq_set - set the CPU frequency * @policy: pointer to policy struct where freq is being set * @freq: target frequency in kHz * * Sets the CPU frequency to freq.
*/ staticint cpufreq_set(struct cpufreq_policy *policy, unsignedint freq)
{ int ret = -EINVAL; struct userspace_policy *userspace = policy->governor_data;
pr_debug("cpufreq_set for cpu %u, freq %u kHz\n", policy->cpu, freq);
mutex_lock(&userspace->mutex); if (!userspace->is_managed) goto err;
userspace->setspeed = freq;
ret = __cpufreq_driver_target(policy, freq, CPUFREQ_RELATION_L);
err:
mutex_unlock(&userspace->mutex); return ret;
}
userspace = kzalloc(sizeof(*userspace), GFP_KERNEL); if (!userspace) return -ENOMEM;
mutex_init(&userspace->mutex);
policy->governor_data = userspace; return 0;
}
/* * Any routine that writes to the policy struct will hold the "rwsem" of * policy struct that means it is free to free "governor_data" here.
*/ staticvoid cpufreq_userspace_policy_exit(struct cpufreq_policy *policy)
{
kfree(policy->governor_data);
policy->governor_data = NULL;
}
pr_debug("limit event for cpu %u: %u - %u kHz, currently %u kHz, last set to %u kHz\n",
policy->cpu, policy->min, policy->max, policy->cur, userspace->setspeed);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.