2361be23666232dbb4851a527f466c4cbf5340fc changed cpufreq to add the
global cpufreq kobject to sysfs on demand.
To ensure this happens, cpufreq_interactive must hold a reference on
this object on devices where it intends to use it (i.e., devices where
have_governor_per_policy() returns false). Otherwise a parentless
kobject will be passed to sysfs_create_group() which will subsequently
BUG().
Change-Id: I7dd03956e1d3c6c3c0cc17c799882c235804ae09
Signed-off-by: Greg Hackmann <ghackmann@google.com>
spin_lock_init(&tunables->above_hispeed_delay_lock);
policy->governor_data = tunables;
- if (!have_governor_per_policy())
+ if (!have_governor_per_policy()) {
common_tunables = tunables;
+ WARN_ON(cpufreq_get_global_kobject());
+ }
rc = sysfs_create_group(get_governor_parent_kobj(policy),
get_sysfs_attr());
sysfs_remove_group(get_governor_parent_kobj(policy),
get_sysfs_attr());
+
+ if (!have_governor_per_policy())
+ cpufreq_put_global_kobject();
+
kfree(tunables);
common_tunables = NULL;
}