summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordianlujitao <dianlujitao@lineageos.org>2019-02-23 20:24:57 +0800
committerElektroschmock <elektroschmock78@googlemail.com>2019-03-14 17:54:49 +0100
commit412fbab4851478670ff6341a368b2105f9eb14cc (patch)
treef96c4da67b2f97cc4eeac9fa38aff5ea1bb78c1b
parent424aa23b5ac330d584feeed6ee76b6c164788429 (diff)
shamu: power: Pass NULL parameter in powerHint if data is zero
* This restores the behavior in AOSP and CAF power HAL to avoid confusion. Change-Id: I72f5bb9286e2f57121e39eea82d2fe8854989393
-rw-r--r--hidl/power/Power.cpp2
-rw-r--r--hidl/power/power-8084.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/hidl/power/Power.cpp b/hidl/power/Power.cpp
index 504a3daf..9d282537 100644
--- a/hidl/power/Power.cpp
+++ b/hidl/power/Power.cpp
@@ -55,7 +55,7 @@ Return<void> Power::setInteractive(bool interactive) {
}
Return<void> Power::powerHint(PowerHint hint, int32_t data) {
- power_hint(static_cast<power_hint_t>(hint), &data);
+ power_hint(static_cast<power_hint_t>(hint), data ? (&data) : NULL);
return Void();
}
diff --git a/hidl/power/power-8084.c b/hidl/power/power-8084.c
index f5bc80ae..3820df08 100644
--- a/hidl/power/power-8084.c
+++ b/hidl/power/power-8084.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2014, The Linux Foundation. All rights reserved.
- * Copyright (C) 2018 The LineageOS Project
+ * Copyright (C) 2018-2019 The LineageOS Project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -96,8 +96,9 @@ int get_number_of_profiles()
}
#endif
-static int set_power_profile(int profile)
+static int set_power_profile(void *data)
{
+ int profile = data ? *((int*)data) : 0;
int ret = -EINVAL;
const char *profile_name = NULL;
@@ -202,7 +203,7 @@ int power_hint_override(power_hint_t hint, void *data)
int duration;
if (hint == POWER_HINT_SET_PROFILE) {
- if (set_power_profile(*(int32_t *)data) < 0)
+ if (set_power_profile(data) < 0)
ALOGE("mpdecision not started in a timely manner.");
return HINT_HANDLED;
}