mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-07 12:25:00 -04:00
cpuidle: lpm-levels: convert PSCI return value to boolean correctly
LPM driver is concerned with the boolean result of the PSCI call. The PSCI error value is not of consequence for further activity. However, it might be helpful to know what the PSCI driver. So, let's log the return value but use the boolean result elsewhere. Change-Id: Ibbc674803da139aef29121d123625661e26bc75d Signed-off-by: Lina Iyer <ilina@codeaurora.org>
This commit is contained in:
parent
7522c692ed
commit
fc520c6971
2 changed files with 23 additions and 15 deletions
|
|
@ -1097,10 +1097,10 @@ unlock_and_return:
|
|||
return state_id;
|
||||
}
|
||||
|
||||
static bool psci_enter_sleep(struct lpm_cpu *cpu, int idx, bool from_idle)
|
||||
static int psci_enter_sleep(struct lpm_cpu *cpu, int idx, bool from_idle)
|
||||
{
|
||||
int affinity_level = 0, state_id = 0, power_state = 0;
|
||||
bool success = false;
|
||||
int ret, success;
|
||||
/*
|
||||
* idx = 0 is the default LPM state
|
||||
*/
|
||||
|
|
@ -1109,12 +1109,13 @@ static bool psci_enter_sleep(struct lpm_cpu *cpu, int idx, bool from_idle)
|
|||
stop_critical_timings();
|
||||
cpu_do_idle();
|
||||
start_critical_timings();
|
||||
return true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (from_idle && cpu->levels[idx].use_bc_timer) {
|
||||
if (tick_broadcast_enter())
|
||||
return success;
|
||||
ret = tick_broadcast_enter();
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
state_id = get_cluster_id(cpu->parent, &affinity_level, from_idle);
|
||||
|
|
@ -1126,7 +1127,8 @@ static bool psci_enter_sleep(struct lpm_cpu *cpu, int idx, bool from_idle)
|
|||
0xdeaffeed, 0xdeaffeed, from_idle);
|
||||
stop_critical_timings();
|
||||
|
||||
success = !psci_cpu_suspend_enter(state_id);
|
||||
ret = psci_cpu_suspend_enter(state_id);
|
||||
success = (ret == 0);
|
||||
|
||||
start_critical_timings();
|
||||
update_debug_pc_event(CPU_EXIT, state_id,
|
||||
|
|
@ -1135,7 +1137,7 @@ static bool psci_enter_sleep(struct lpm_cpu *cpu, int idx, bool from_idle)
|
|||
if (from_idle && cpu->levels[idx].use_bc_timer)
|
||||
tick_broadcast_exit();
|
||||
|
||||
return success;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int lpm_cpuidle_select(struct cpuidle_driver *drv,
|
||||
|
|
@ -1191,6 +1193,7 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
|
|||
const struct cpumask *cpumask = get_cpu_mask(dev->cpu);
|
||||
ktime_t start = ktime_get();
|
||||
uint64_t start_time = ktime_to_ns(start), end_time;
|
||||
int ret = -EBUSY;
|
||||
|
||||
cpu_prepare(cpu, idx, true);
|
||||
cluster_prepare(cpu->parent, cpumask, idx, true, start_time);
|
||||
|
|
@ -1201,7 +1204,8 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
|
|||
if (need_resched())
|
||||
goto exit;
|
||||
|
||||
success = psci_enter_sleep(cpu, idx, true);
|
||||
ret = psci_enter_sleep(cpu, idx, true);
|
||||
success = (ret == 0);
|
||||
|
||||
exit:
|
||||
end_time = ktime_to_ns(ktime_get());
|
||||
|
|
@ -1211,7 +1215,7 @@ exit:
|
|||
cpu_unprepare(cpu, idx, true);
|
||||
dev->last_residency = ktime_us_delta(ktime_get(), start);
|
||||
update_history(dev, idx);
|
||||
trace_cpu_idle_exit(idx, success);
|
||||
trace_cpu_idle_exit(idx, ret);
|
||||
if (lpm_prediction && cpu->lpm_prediction) {
|
||||
histtimer_cancel();
|
||||
clusttimer_cancel();
|
||||
|
|
@ -1225,7 +1229,8 @@ static void lpm_cpuidle_s2idle(struct cpuidle_device *dev,
|
|||
{
|
||||
struct lpm_cpu *cpu = per_cpu(cpu_lpm, dev->cpu);
|
||||
const struct cpumask *cpumask = get_cpu_mask(dev->cpu);
|
||||
bool success = false;
|
||||
bool success;
|
||||
int ret;
|
||||
|
||||
for (; idx >= 0; idx--) {
|
||||
if (lpm_cpu_mode_allow(dev->cpu, idx, false))
|
||||
|
|
@ -1239,7 +1244,8 @@ static void lpm_cpuidle_s2idle(struct cpuidle_device *dev,
|
|||
cpu_prepare(cpu, idx, true);
|
||||
cluster_prepare(cpu->parent, cpumask, idx, false, 0);
|
||||
|
||||
success = psci_enter_sleep(cpu, idx, false);
|
||||
ret = psci_enter_sleep(cpu, idx, false);
|
||||
success = (ret == 0);
|
||||
|
||||
cluster_unprepare(cpu->parent, cpumask, idx, false, 0, success);
|
||||
cpu_unprepare(cpu, idx, true);
|
||||
|
|
@ -1443,6 +1449,7 @@ static int lpm_suspend_enter(suspend_state_t state)
|
|||
const struct cpumask *cpumask = get_cpu_mask(cpu);
|
||||
int idx;
|
||||
bool success;
|
||||
int ret;
|
||||
|
||||
for (idx = lpm_cpu->nlevels - 1; idx >= 0; idx--) {
|
||||
if (lpm_cpu_mode_allow(cpu, idx, false))
|
||||
|
|
@ -1455,7 +1462,8 @@ static int lpm_suspend_enter(suspend_state_t state)
|
|||
cpu_prepare(lpm_cpu, idx, false);
|
||||
cluster_prepare(cluster, cpumask, idx, false, 0);
|
||||
|
||||
success = psci_enter_sleep(lpm_cpu, idx, false);
|
||||
ret = psci_enter_sleep(lpm_cpu, idx, false);
|
||||
success = (ret == 0);
|
||||
|
||||
cluster_unprepare(cluster, cpumask, idx, false, 0, success);
|
||||
cpu_unprepare(lpm_cpu, idx, false);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#undef TRACE_SYSTEM
|
||||
|
|
@ -105,13 +105,13 @@ TRACE_EVENT(cpu_idle_enter,
|
|||
|
||||
TRACE_EVENT(cpu_idle_exit,
|
||||
|
||||
TP_PROTO(int index, bool success),
|
||||
TP_PROTO(int index, int success),
|
||||
|
||||
TP_ARGS(index, success),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__field(int, index)
|
||||
__field(bool, success)
|
||||
__field(int, success)
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
|
|
|
|||
Loading…
Reference in a new issue