cpufreq: move call to __find_governor() to cpufreq_init_policy()
authorviresh kumar <viresh.kumar@linaro.org>
Tue, 4 Mar 2014 03:43:59 +0000 (11:43 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 6 Mar 2014 13:38:44 +0000 (14:38 +0100)
commit6e2c89d16d987e6e11c531b039a42d3f5f1d7c32
tree99eebd82caf833fba1b904db638946cb3cf44cf6
parent3b4aff047275574bff8f50a654d51166d9574079
cpufreq: move call to __find_governor() to cpufreq_init_policy()

We call __find_governor() during the addition of the first CPU of
each policy from __cpufreq_add_dev() to find the last governor used
for this CPU before it was hot-removed.

After that we call cpufreq_parse_governor() in cpufreq_init_policy(),
either with this governor, or with the default governor. Right after
that policy->governor is set to NULL.

While that code is not functionally problematic, the structure of it
is suboptimal, because some of the code required in cpufreq_init_policy()
is being executed by its caller, __cpufreq_add_dev(). So, it would make
more sense to get all of it together in a single place to make code more
readable.

Accordingly, move the code needed for policy initialization to
cpufreq_init_policy() and initialize policy->governor to NULL at the
beginning.

In order to clean up the code a bit more, some of the #ifdefs for
CONFIG_HOTPLUG_CPU are dropped too.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[rjw: Changelog]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c