power_hikey: Simplify init function by pulling calculate_max_freq() in
Simplify the number of functions by inlining the
calculate_max_freq logic into the init function.
Change-Id: I5800d2b0b6e0d5db83337b5549bf1a7e134fa65e
Signed-off-by: John Stultz <john.stultz@linaro.org>
diff --git a/power/power_hikey.c b/power/power_hikey.c
index ea63916..c53603c 100644
--- a/power/power_hikey.c
+++ b/power/power_hikey.c
@@ -76,20 +76,10 @@
close(fd);
}
-static void calculate_max_cpu_freq() {
- int32_t is_svelte = property_get_int32(SVELTE_PROP, 0);
-
- if (is_svelte) {
- char prop_buffer[PROPERTY_VALUE_MAX];
- int len = property_get(SVELTE_MAX_FREQ_PROP, prop_buffer, LOW_POWER_MAX_FREQ);
- max_cpu_freq = strndup(prop_buffer, len);
- len = property_get(SVELTE_LOW_POWER_MAX_FREQ_PROP, prop_buffer, LOW_POWER_MAX_FREQ);
- low_power_max_cpu_freq = strndup(prop_buffer, len);
- }
-}
-
static void power_init(struct power_module __unused *module)
{
+ int32_t is_svelte = property_get_int32(SVELTE_PROP, 0);
+
sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/timer_rate",
"20000");
sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/timer_slack",
@@ -108,7 +98,14 @@
"1000000");
sysfs_write("/sys/devices/system/cpu/cpufreq/interactive/io_is_busy", "0");
- calculate_max_cpu_freq();
+ if (is_svelte) {
+ char prop_buffer[PROPERTY_VALUE_MAX];
+ int len = property_get(SVELTE_MAX_FREQ_PROP, prop_buffer, LOW_POWER_MAX_FREQ);
+
+ max_cpu_freq = strndup(prop_buffer, len);
+ len = property_get(SVELTE_LOW_POWER_MAX_FREQ_PROP, prop_buffer, LOW_POWER_MAX_FREQ);
+ low_power_max_cpu_freq = strndup(prop_buffer, len);
+ }
}
static void power_set_interactive(struct power_module __unused *module, int on)