diff options
author | John Stultz <john.stultz@linaro.org> | 2017-11-02 21:23:22 -0700 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2017-11-02 21:25:59 -0700 |
commit | 5af9bdca62d686dd0554269f1ef4027e9a95b60b (patch) | |
tree | 429c19b7a342a7512482fa79cd09b0c7f38a1285 | |
parent | 5a54c7157fee75a0f31b0d84d06a9010fd56beb6 (diff) | |
download | hikey-5af9bdca62d686dd0554269f1ef4027e9a95b60b.tar.gz |
hikey: Fix power-hal logcat noise
The way powerhal modules are initialized maybe changed
or was always broken, but as it is, some of the hikey power
module entries were not being initialized properly.
This was causing lots of noise in the logs, and potentially
other problematic behavior.
This changes the initial allocation so we allocate the whole
structure and initialize it properly.
Change-Id: I7d7858c2890d03758b302b95f18bd1c35b6ef85b
Signed-off-by: John Stultz <john.stultz@linaro.org>
-rw-r--r-- | power/power_hikey.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/power/power_hikey.c b/power/power_hikey.c index 8d687fe3..46617025 100644 --- a/power/power_hikey.c +++ b/power/power_hikey.c @@ -405,21 +405,25 @@ static int power_open(const hw_module_t* __unused module, const char* name, ALOGD("%s: enter; name=%s", __FUNCTION__, name); if (strcmp(name, POWER_HARDWARE_MODULE_ID) == 0) { - power_module_t *dev = (power_module_t *)calloc(1, - sizeof(power_module_t)); + struct hikey_power_module *dev = (struct hikey_power_module *)calloc(1, + sizeof(struct hikey_power_module)); if (dev) { /* Common hw_device_t fields */ - dev->common.tag = HARDWARE_DEVICE_TAG; - dev->common.module_api_version = POWER_MODULE_API_VERSION_0_5; - dev->common.hal_api_version = HARDWARE_HAL_API_VERSION; + dev->base.common.tag = HARDWARE_DEVICE_TAG; + dev->base.common.module_api_version = POWER_MODULE_API_VERSION_0_5; + dev->base.common.hal_api_version = HARDWARE_HAL_API_VERSION; - dev->init = hikey_power_init; - dev->powerHint = hikey_power_hint; - dev->setInteractive = hikey_cpufreq_set_interactive; - dev->setFeature = set_feature; + dev->base.init = hikey_power_init; + dev->base.powerHint = hikey_power_hint; + dev->base.setInteractive = hikey_cpufreq_set_interactive; + dev->base.setFeature = set_feature; - *device = (hw_device_t*)dev; + pthread_mutex_init(&dev->lock, NULL); + dev->boostpulse_fd = -1; + dev->boostpulse_warned = 0; + + *device = (hw_device_t*)&dev->base; } else retval = -ENOMEM; } else { @@ -445,14 +449,5 @@ struct hikey_power_module HAL_MODULE_INFO_SYM = { .author = "The Android Open Source Project", .methods = &power_module_methods, }, - - .init = hikey_power_init, - .setInteractive = hikey_cpufreq_set_interactive, - .powerHint = hikey_power_hint, - .setFeature = set_feature, }, - - .lock = PTHREAD_MUTEX_INITIALIZER, - .boostpulse_fd = -1, - .boostpulse_warned = 0, }; |