Loading power/1.0/default/Power.cpp +18 −16 Original line number Diff line number Diff line Loading @@ -145,26 +145,28 @@ done: } IPower* HIDL_FETCH_IPower(const char* /* name */) { int ret = 0; const hw_module_t* hw_module = NULL; power_module_t *power_module; ret = hw_get_module(POWER_HARDWARE_MODULE_ID, &hw_module); if (ret == 0 && hw_module->methods->open) { ret = hw_module->methods->open(hw_module, POWER_HARDWARE_MODULE_ID, reinterpret_cast<hw_device_t**>(&power_module)); if (ret == 0) { return new Power(power_module); } else { ALOGE("Passthrough failed to load legacy power HAL."); const hw_module_t* hw_module = nullptr; power_module_t* power_module = nullptr; int err = hw_get_module(POWER_HARDWARE_MODULE_ID, &hw_module); if (err) { ALOGE("hw_get_module %s failed: %d", POWER_HARDWARE_MODULE_ID, err); return nullptr; } } else { ALOGE ("hw_get_module %s failed: %d", POWER_HARDWARE_MODULE_ID, ret); if (!hw_module->methods || !hw_module->methods->open) { power_module = reinterpret_cast<power_module_t*>( const_cast<hw_module_t*>(hw_module)); } else { err = hw_module->methods->open( hw_module, POWER_HARDWARE_MODULE_ID, reinterpret_cast<hw_device_t**>(&power_module)); if (err) { ALOGE("Passthrough failed to load legacy HAL."); return nullptr; } } return new Power(power_module); } } // namespace implementation } // namespace V1_0 Loading Loading
power/1.0/default/Power.cpp +18 −16 Original line number Diff line number Diff line Loading @@ -145,26 +145,28 @@ done: } IPower* HIDL_FETCH_IPower(const char* /* name */) { int ret = 0; const hw_module_t* hw_module = NULL; power_module_t *power_module; ret = hw_get_module(POWER_HARDWARE_MODULE_ID, &hw_module); if (ret == 0 && hw_module->methods->open) { ret = hw_module->methods->open(hw_module, POWER_HARDWARE_MODULE_ID, reinterpret_cast<hw_device_t**>(&power_module)); if (ret == 0) { return new Power(power_module); } else { ALOGE("Passthrough failed to load legacy power HAL."); const hw_module_t* hw_module = nullptr; power_module_t* power_module = nullptr; int err = hw_get_module(POWER_HARDWARE_MODULE_ID, &hw_module); if (err) { ALOGE("hw_get_module %s failed: %d", POWER_HARDWARE_MODULE_ID, err); return nullptr; } } else { ALOGE ("hw_get_module %s failed: %d", POWER_HARDWARE_MODULE_ID, ret); if (!hw_module->methods || !hw_module->methods->open) { power_module = reinterpret_cast<power_module_t*>( const_cast<hw_module_t*>(hw_module)); } else { err = hw_module->methods->open( hw_module, POWER_HARDWARE_MODULE_ID, reinterpret_cast<hw_device_t**>(&power_module)); if (err) { ALOGE("Passthrough failed to load legacy HAL."); return nullptr; } } return new Power(power_module); } } // namespace implementation } // namespace V1_0 Loading