summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLina Iyer <ilina@codeaurora.org>2017-07-17 11:50:25 -0600
committerGeorg Veichtlbauer <georg@vware.at>2023-07-16 12:47:43 +0200
commitc71b8fffe6b3d099b76c05f922fde8aa4b6c2334 (patch)
tree1afd4420676bcc6587fbb5eab37e91e31b40f4a9
parent938e42ca699f3224fcb9687bf9feba3f4a1abf32 (diff)
drivers: cpuidle: lpm-levels: Fix KW issues with idle state idx < 0
Idle state calculcations will need to return the state chosen as an integer. The state chosen is used as a index into the array and as such cannot be negative value. Do not return negative errors from the calculations. By default, the state returned wil be zero. Change-Id: Idb18e933f385cf868fe99fa6a2783f6b8e84c196 Signed-off-by: Lina Iyer <ilina@codeaurora.org>
-rw-r--r--drivers/cpuidle/lpm-levels.c15
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/cpuidle/lpm-levels.c b/drivers/cpuidle/lpm-levels.c
index f46126e41266..dca59eadc6c2 100644
--- a/drivers/cpuidle/lpm-levels.c
+++ b/drivers/cpuidle/lpm-levels.c
@@ -691,7 +691,7 @@ static void update_history(struct cpuidle_device *dev, int idx);
static int cpu_power_select(struct cpuidle_device *dev,
struct lpm_cpu *cpu)
{
- int best_level = -1;
+ int best_level = 0;
uint32_t latency_us = pm_qos_request_for_cpu(PM_QOS_CPU_DMA_LATENCY,
dev->cpu);
s64 sleep_us = ktime_to_us(tick_nohz_get_sleep_length());
@@ -705,8 +705,6 @@ static int cpu_power_select(struct cpuidle_device *dev,
uint32_t *min_residency = get_per_cpu_min_residency(dev->cpu);
uint32_t *max_residency = get_per_cpu_max_residency(dev->cpu);
- if (!cpu)
- return -EINVAL;
if ((sleep_disabled && !cpu_isolated(dev->cpu)) || sleep_us < 0)
return 0;
@@ -1536,17 +1534,11 @@ static int lpm_cpuidle_select(struct cpuidle_driver *drv,
struct cpuidle_device *dev)
{
struct lpm_cluster *cluster = per_cpu(cpu_cluster, dev->cpu);
- int idx;
if (!cluster)
return 0;
- idx = cpu_power_select(dev, cluster->cpu);
-
- if (idx < 0)
- return -EPERM;
-
- return idx;
+ return cpu_power_select(dev, cluster->cpu);
}
static void update_history(struct cpuidle_device *dev, int idx)
@@ -1591,9 +1583,6 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
int64_t start_time = ktime_to_ns(ktime_get()), end_time;
struct power_params *pwr_params;
- if (idx < 0)
- return -EINVAL;
-
pwr_params = &cluster->cpu->levels[idx].pwr;
sched_set_cpu_cstate(smp_processor_id(), idx + 1,
pwr_params->energy_overhead, pwr_params->latency_us);