From 032a76561db2a6677ceebadfe3c9e26211d771ce Mon Sep 17 00:00:00 2001 From: bengris32 Date: Thu, 26 Oct 2023 22:39:41 +0100 Subject: [PATCH] power-mediatek: Run clang-format Change-Id: I76ff3c8e6e541113d538d44a0b6810e3adfc445b Signed-off-by: bengris32 --- .clang-format | 1 + aidl/power-mediatek/Power.cpp | 24 +++++++++++------------- aidl/power-mediatek/Power.h | 11 ++++++----- aidl/power-mediatek/types.h | 2 +- 4 files changed, 19 insertions(+), 19 deletions(-) create mode 120000 .clang-format diff --git a/.clang-format b/.clang-format new file mode 120000 index 0000000..ddcf5a2 --- /dev/null +++ b/.clang-format @@ -0,0 +1 @@ +../../build/soong/scripts/system-clang-format \ No newline at end of file diff --git a/aidl/power-mediatek/Power.cpp b/aidl/power-mediatek/Power.cpp index 8fd3028..b029175 100644 --- a/aidl/power-mediatek/Power.cpp +++ b/aidl/power-mediatek/Power.cpp @@ -16,11 +16,11 @@ #include #endif -#define DLSYM_GET_FUNCTION(func_ptr, handle, func_name) \ - func_ptr = (typeof(func_ptr))dlsym(handle, #func_name); \ - if (func_ptr == NULL) { \ +#define DLSYM_GET_FUNCTION(func_ptr, handle, func_name) \ + func_ptr = (typeof(func_ptr))dlsym(handle, #func_name); \ + if (func_ptr == NULL) { \ LOG(ERROR) << "Could not locate symbol " #func_name "."; \ - abort(); \ + abort(); \ } namespace aidl { @@ -57,7 +57,7 @@ Power::Power() { mPerf->Init(1); } -Power::~Power() { } +Power::~Power() {} long long Power::calcTimespanUs(struct timespec start, struct timespec end) { long long diff_in_us = 0; @@ -79,7 +79,7 @@ void Power::handleInteractionHint(int32_t targetDuration) { if (targetDuration > durationMs) { durationMs = (targetDuration > kMaxInteractiveDuration) ? kMaxInteractiveDuration - : targetDuration; + : targetDuration; } clock_gettime(CLOCK_MONOTONIC, ¤tInteractionTime); @@ -123,26 +123,24 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) { #endif switch (type) { #ifdef TAP_TO_WAKE_NODE - case Mode::DOUBLE_TAP_TO_WAKE: - { + case Mode::DOUBLE_TAP_TO_WAKE: { ::android::base::WriteStringToFile(enabled ? "1" : "0", TAP_TO_WAKE_NODE, true); break; } #endif - case Mode::LAUNCH: - { + case Mode::LAUNCH: { if (mLaunchHandle > 0) { mPerf->LockRel(mLaunchHandle); mLaunchHandle = 0; } if (enabled) { - mLaunchHandle = mPerf->CusLockHint(MTKPOWER_HINT_LAUNCH, kLaunchBoostDuration, getpid()); + mLaunchHandle = + mPerf->CusLockHint(MTKPOWER_HINT_LAUNCH, kLaunchBoostDuration, getpid()); } break; } - case Mode::INTERACTIVE: - { + case Mode::INTERACTIVE: { if (enabled) { // Device is now in an interactive state, // resume all previously performing hints. diff --git a/aidl/power-mediatek/Power.h b/aidl/power-mediatek/Power.h index 7e11e35..d859542 100644 --- a/aidl/power-mediatek/Power.h +++ b/aidl/power-mediatek/Power.h @@ -18,13 +18,13 @@ namespace power { namespace impl { namespace mediatek { -const int32_t kTouchBoostDuration = 25; /* ms */ +const int32_t kTouchBoostDuration = 25; /* ms */ const int32_t kMinInteractiveDuration = 400; /* ms */ const int32_t kMaxInteractiveDuration = 5000; /* ms */ -const int32_t kLaunchBoostDuration = 30000; /* ms */ +const int32_t kLaunchBoostDuration = 30000; /* ms */ class Power : public BnPower { -public: + public: Power(); ~Power(); ndk::ScopedAStatus setMode(Mode type, bool enabled) override; @@ -36,11 +36,12 @@ public: int64_t durationNanos, std::shared_ptr* _aidl_return) override; ndk::ScopedAStatus getHintSessionPreferredRate(int64_t* outNanoseconds) override; -private: + + private: static long long calcTimespanUs(struct timespec start, struct timespec end); void handleInteractionHint(int32_t targetDuration); - libpowerhal_t *mPerf; + libpowerhal_t* mPerf; struct timespec mPreviousInteractionTime; int32_t mPreviousInteractionDuration; diff --git a/aidl/power-mediatek/types.h b/aidl/power-mediatek/types.h index d00533c..c214c1f 100644 --- a/aidl/power-mediatek/types.h +++ b/aidl/power-mediatek/types.h @@ -16,7 +16,7 @@ #define NSINUS 1000L typedef struct libpowerhal_t { - void *perfLib; + void* perfLib; void (*Init)(int32_t); void (*LockRel)(int32_t); void (*UserScnDisableAll)(void);