From fb21425e46d48c18430b576a306dac273f7b00a4 Mon Sep 17 00:00:00 2001 From: Arian Date: Wed, 13 Oct 2021 12:44:09 +0200 Subject: [PATCH] Revert "power-libperfmgr: simply wait if idle state node is not present" This reverts commit 297888275a44b3ce0e75fb1b50bea5108fc67459. Change-Id: Iefee44a1f407729e76cb693832bad4998141c42b --- aidl/power-libperfmgr/InteractionHandler.cpp | 25 +++++--------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/aidl/power-libperfmgr/InteractionHandler.cpp b/aidl/power-libperfmgr/InteractionHandler.cpp index 0c28365..9ca52a6 100644 --- a/aidl/power-libperfmgr/InteractionHandler.cpp +++ b/aidl/power-libperfmgr/InteractionHandler.cpp @@ -65,14 +65,15 @@ bool InteractionHandler::Init() { if (mState != INTERACTION_STATE_UNINITIALIZED) return true; - mIdleFd = fb_idle_open(); + int fd = fb_idle_open(); + if (fd < 0) + return false; + mIdleFd = fd; mEventFd = eventfd(0, EFD_NONBLOCK); if (mEventFd < 0) { ALOGE("Unable to create event fd (%d)", errno); - if (mIdleFd >= 0) { - close(mIdleFd); - } + close(mIdleFd); return false; } @@ -95,9 +96,7 @@ void InteractionHandler::Exit() { mThread->join(); close(mEventFd); - if (mIdleFd >= 0) { - close(mIdleFd); - } + close(mIdleFd); } void InteractionHandler::PerfLock() { @@ -213,18 +212,6 @@ void InteractionHandler::WaitForIdle(int32_t wait_ms, int32_t timeout_ms) { return; } - if (mIdleFd < 0) { - ret = poll(pfd, 1, timeout_ms); - if (ret > 0) { - ALOGV("%s: wait for duration aborted", __func__); - return; - } else if (ret < 0) { - ALOGE("%s: Error on waiting for duration (%zd)", __func__, ret); - return; - } - return; - } - ret = pread(mIdleFd, data, sizeof(data), 0); if (!ret) { ALOGE("%s: Unexpected EOF!", __func__); -- 2.20.1