summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--power-660.c11
-rw-r--r--power-8916.c11
-rw-r--r--power-8952.c11
-rw-r--r--power-8953.c11
-rw-r--r--power-8974.c11
5 files changed, 25 insertions, 30 deletions
diff --git a/power-660.c b/power-660.c
index b2870bd..5c87fe8 100644
--- a/power-660.c
+++ b/power-660.c
@@ -59,17 +59,16 @@ static void process_video_encode_hint(void* metadata);
// static void process_cam_preview_hint(void *metadata);
/**
- * If target is SDM630/SDM455:
- * return true
- * else:
- * return false
+ * Returns true if the target is SDM630/SDM455.
*/
static bool is_target_SDM630(void) {
- static bool is_SDM630 = false;
+ static int is_SDM630 = -1;
int soc_id;
+ if (is_SDM630 >= 0) return is_SDM630;
+
soc_id = get_soc_id();
- if (soc_id == 318 || soc_id == 327 || soc_id == 385) is_SDM630 = true;
+ is_SDM630 = soc_id == 318 || soc_id == 327 || soc_id == 385;
return is_SDM630;
}
diff --git a/power-8916.c b/power-8916.c
index 81d7be9..cde0f28 100644
--- a/power-8916.c
+++ b/power-8916.c
@@ -59,17 +59,16 @@ char scaling_min_freq[4][80] = {"sys/devices/system/cpu/cpu0/cpufreq/scaling_min
static int slack_node_rw_failed = 0;
/**
- * If target is 8916:
- * return true
- * else:
- * return false
+ * Returns true if the target is MSM8916.
*/
static bool is_target_8916(void) {
- static bool is_8916 = false;
+ static int is_8916 = -1;
int soc_id;
+ if (is_8916 >= 0) return is_8916;
+
soc_id = get_soc_id();
- if (soc_id == 206 || (soc_id >= 247 && soc_id <= 250)) is_8916 = true;
+ is_8916 = soc_id == 206 || (soc_id >= 247 && soc_id <= 250);
return is_8916;
}
diff --git a/power-8952.c b/power-8952.c
index 2fb3b19..d666700 100644
--- a/power-8952.c
+++ b/power-8952.c
@@ -58,17 +58,16 @@ static int display_fd;
#define SYS_DISPLAY_PWR "/sys/kernel/hbtp/display_pwr"
/**
- * If target is SDM439/429:
- * return true
- * else:
- * return false
+ * Returns true if the target is SDM439/SDM429.
*/
static bool is_target_SDM439(void) {
- static bool is_SDM439 = false;
+ static int is_SDM439 = -1;
int soc_id;
+ if (is_SDM439 >= 0) return is_SDM439;
+
soc_id = get_soc_id();
- if (soc_id == 353 || soc_id == 363 || soc_id == 354 || soc_id == 364) is_SDM439 = true;
+ is_SDM439 = soc_id == 353 || soc_id == 363 || soc_id == 354 || soc_id == 364;
return is_SDM439;
}
diff --git a/power-8953.c b/power-8953.c
index cd372d7..3b85a04 100644
--- a/power-8953.c
+++ b/power-8953.c
@@ -62,17 +62,16 @@ static int display_fd;
#define SYS_DISPLAY_PWR "/sys/kernel/hbtp/display_pwr"
/**
- * If target is SDM632:
- * return true
- * else:
- * return false
+ * Returns true if the target is SDM632.
*/
static bool is_target_SDM632(void) {
- static bool is_SDM632 = false;
+ static int is_SDM632 = -1;
int soc_id;
+ if (is_SDM632 >= 0) return is_SDM632;
+
soc_id = get_soc_id();
- if (soc_id == 349 || soc_id == 350) is_SDM632 = true;
+ is_SDM632 = soc_id == 349 || soc_id == 350;
return is_SDM632;
}
diff --git a/power-8974.c b/power-8974.c
index 624534c..1b171e1 100644
--- a/power-8974.c
+++ b/power-8974.c
@@ -50,17 +50,16 @@
static int first_display_off_hint;
/**
- * If target is 8974pro:
- * return true
- * else:
- * return false
+ * Returns true if the target is MSM8974AB or MSM8974AC.
*/
static bool is_target_8974pro(void) {
- static bool is_8974pro = false;
+ static int is_8974pro = -1;
int soc_id;
+ if (is_8974pro >= 0) return is_8974pro;
+
soc_id = get_soc_id();
- if (soc_id == 194 || (soc_id >= 208 && soc_id <= 218)) is_8974pro = true;
+ is_8974pro = soc_id == 194 || (soc_id >= 208 && soc_id <= 218);
return is_8974pro;
}