power_hikey: Split boostpluse logic into its own function
This patch splits the boostpulse logic into its own function
and pre-pends interactive_ to the function names to make it
clear these are for the interactive gov
Change-Id: Icabd29110b9a13c43ed0495a18dcf35703657adf
Signed-off-by: John Stultz <john.stultz@linaro.org>
diff --git a/power/power_hikey.c b/power/power_hikey.c
index c53603c..2ac5576 100644
--- a/power/power_hikey.c
+++ b/power/power_hikey.c
@@ -121,7 +121,7 @@
ALOGV("power_set_interactive: %d done\n", on);
}
-static int boostpulse_open(struct hikey_power_module *hikey)
+static int interactive_boostpulse_open(struct hikey_power_module *hikey)
{
char buf[80];
int len;
@@ -140,6 +140,22 @@
return hikey->boostpulse_fd;
}
+static int interactive_boostpulse(struct hikey_power_module *hikey)
+{
+ char buf[80];
+ int len;
+
+ if (interactive_boostpulse_open(hikey) >= 0) {
+ len = write(hikey->boostpulse_fd, "1", 1);
+
+ if (len < 0) {
+ strerror_r(errno, buf, sizeof(buf));
+ ALOGE("Error writing to %s: %s\n", BOOSTPULSE_PATH, buf);
+ }
+ }
+ return 0;
+}
+
static void set_feature(struct power_module *module, feature_t feature, int state)
{
struct hikey_power_module *hikey =
@@ -156,21 +172,11 @@
{
struct hikey_power_module *hikey =
(struct hikey_power_module *) module;
- char buf[80];
- int len;
pthread_mutex_lock(&hikey->lock);
switch (hint) {
case POWER_HINT_INTERACTION:
- if (boostpulse_open(hikey) >= 0) {
- len = write(hikey->boostpulse_fd, "1", 1);
-
- if (len < 0) {
- strerror_r(errno, buf, sizeof(buf));
- ALOGE("Error writing to %s: %s\n", BOOSTPULSE_PATH, buf);
- }
- }
-
+ interactive_boostpulse(hikey);
break;
case POWER_HINT_VSYNC: