Skip to content

Commit

Permalink
Merge back earlier cpufreq changes for 5.19.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafael J. Wysocki committed May 5, 2022
2 parents 0f03610 + f346e96 commit 02678c0
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 14 deletions.
5 changes: 3 additions & 2 deletions drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1533,8 +1533,6 @@ static int cpufreq_online(unsigned int cpu)
for_each_cpu(j, policy->real_cpus)
remove_cpu_dev_symlink(policy, get_cpu_device(j));

up_write(&policy->rwsem);

out_offline_policy:
if (cpufreq_driver->offline)
cpufreq_driver->offline(policy);
Expand All @@ -1543,6 +1541,9 @@ static int cpufreq_online(unsigned int cpu)
if (cpufreq_driver->exit)
cpufreq_driver->exit(policy);

cpumask_clear(policy->cpus);
up_write(&policy->rwsem);

out_free_policy:
cpufreq_policy_free(policy);
return ret;
Expand Down
20 changes: 13 additions & 7 deletions drivers/cpufreq/cpufreq_governor.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,15 @@ static void free_policy_dbs_info(struct policy_dbs_info *policy_dbs,
gov->free(policy_dbs);
}

static void cpufreq_dbs_data_release(struct kobject *kobj)
{
struct dbs_data *dbs_data = to_dbs_data(to_gov_attr_set(kobj));
struct dbs_governor *gov = dbs_data->gov;

gov->exit(dbs_data);
kfree(dbs_data);
}

int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)
{
struct dbs_governor *gov = dbs_governor_of(policy);
Expand Down Expand Up @@ -425,6 +434,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)
goto free_policy_dbs_info;
}

dbs_data->gov = gov;
gov_attr_set_init(&dbs_data->attr_set, &policy_dbs->list);

ret = gov->init(dbs_data);
Expand All @@ -447,6 +457,7 @@ int cpufreq_dbs_governor_init(struct cpufreq_policy *policy)
policy->governor_data = policy_dbs;

gov->kobj_type.sysfs_ops = &governor_sysfs_ops;
gov->kobj_type.release = cpufreq_dbs_data_release;
ret = kobject_init_and_add(&dbs_data->attr_set.kobj, &gov->kobj_type,
get_governor_parent_kobj(policy),
"%s", gov->gov.name);
Expand Down Expand Up @@ -488,13 +499,8 @@ void cpufreq_dbs_governor_exit(struct cpufreq_policy *policy)

policy->governor_data = NULL;

if (!count) {
if (!have_governor_per_policy())
gov->gdbs_data = NULL;

gov->exit(dbs_data);
kfree(dbs_data);
}
if (!count && !have_governor_per_policy())
gov->gdbs_data = NULL;

free_policy_dbs_info(policy_dbs, gov);

Expand Down
1 change: 1 addition & 0 deletions drivers/cpufreq/cpufreq_governor.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ enum {OD_NORMAL_SAMPLE, OD_SUB_SAMPLE};
/* Governor demand based switching data (per-policy or global). */
struct dbs_data {
struct gov_attr_set attr_set;
struct dbs_governor *gov;
void *tuners;
unsigned int ignore_nice_load;
unsigned int sampling_rate;
Expand Down
1 change: 1 addition & 0 deletions drivers/cpufreq/intel_pstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,7 @@ static ssize_t store_no_turbo(struct kobject *a, struct kobj_attribute *b,
mutex_unlock(&intel_pstate_limits_lock);

intel_pstate_update_policies();
arch_set_max_freq_ratio(global.no_turbo);

mutex_unlock(&intel_pstate_driver_lock);

Expand Down
1 change: 0 additions & 1 deletion drivers/cpufreq/pasemi-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

#include <asm/hw_irq.h>
#include <asm/io.h>
#include <asm/prom.h>
#include <asm/time.h>
#include <asm/smp.h>

Expand Down
2 changes: 1 addition & 1 deletion drivers/cpufreq/pmac32-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <linux/device.h>
#include <linux/hardirq.h>
#include <linux/of_device.h>
#include <asm/prom.h>

#include <asm/machdep.h>
#include <asm/irq.h>
#include <asm/pmac_feature.h>
Expand Down
2 changes: 1 addition & 1 deletion drivers/cpufreq/pmac64-cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <linux/completion.h>
#include <linux/mutex.h>
#include <linux/of_device.h>
#include <asm/prom.h>

#include <asm/machdep.h>
#include <asm/irq.h>
#include <asm/sections.h>
Expand Down
1 change: 0 additions & 1 deletion drivers/cpufreq/ppc_cbe_cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <linux/of_platform.h>

#include <asm/machdep.h>
#include <asm/prom.h>
#include <asm/cell-regs.h>

#include "ppc_cbe_cpufreq.h"
Expand Down
2 changes: 1 addition & 1 deletion drivers/cpufreq/ppc_cbe_cpufreq_pmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include <linux/init.h>
#include <linux/of_platform.h>
#include <linux/pm_qos.h>
#include <linux/slab.h>

#include <asm/processor.h>
#include <asm/prom.h>
#include <asm/pmi.h>
#include <asm/cell-regs.h>

Expand Down

0 comments on commit 02678c0

Please sign in to comment.