Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5ecbe390 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "drivers: cpuidle: lpm-levels: Move local_irq_enable"

parents 668565e9 8b9699dd
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -195,6 +195,11 @@ static void histtimer_cancel(void)
{
	unsigned int cpu = raw_smp_processor_id();
	struct hrtimer *cpu_histtimer = &per_cpu(histtimer, cpu);
	ktime_t time_rem;

	time_rem = hrtimer_get_remaining(cpu_histtimer);
	if (ktime_to_us(time_rem) <= 0)
		return;

	hrtimer_try_to_cancel(cpu_histtimer);
}
@@ -240,12 +245,22 @@ static void clusttimer_cancel(void)
{
	int cpu = raw_smp_processor_id();
	struct lpm_cluster *cluster = per_cpu(cpu_lpm, cpu)->parent;
	ktime_t time_rem;

	time_rem = hrtimer_get_remaining(&cluster->histtimer);
	if (ktime_to_us(time_rem) > 0)
		hrtimer_try_to_cancel(&cluster->histtimer);

	if (cluster->parent)
	if (cluster->parent) {
		time_rem = hrtimer_get_remaining(
			&cluster->parent->histtimer);

		if (ktime_to_us(time_rem) <= 0)
			return;

		hrtimer_try_to_cancel(&cluster->parent->histtimer);
	}
}

static enum hrtimer_restart clusttimer_fn(struct hrtimer *h)
{
@@ -1197,11 +1212,11 @@ static int lpm_cpuidle_enter(struct cpuidle_device *dev,
	dev->last_residency = ktime_us_delta(ktime_get(), start);
	update_history(dev, idx);
	trace_cpu_idle_exit(idx, success);
	local_irq_enable();
	if (lpm_prediction && cpu->lpm_prediction) {
		histtimer_cancel();
		clusttimer_cancel();
	}
	local_irq_enable();
	return idx;
}