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

Commit 514248db authored by Lina Iyer's avatar Lina Iyer Committed by Mahesh Sivasubramanian
Browse files

drivers: cpuidle: lpm-levels: Return non-zero error in .select



cpuidle select calls expects an index into the cpuidle states array as
the return value. The return value is used to index into the state array
and therefore cannot be a negative value or an error return. Further,
its a general understanding across all architectures that use
cpuidle to have a WFI (or equalivalent) mode always present and
never disabled.

To this effect, disallow WFI modes to be disabled and return index 0
(index of WFI state) as the default if no suitable mode is available.

Change-Id: I5a14b0c5549f37427f97ba609321c646e02caae4
Signed-off-by: default avatarLina Iyer <ilina@codeaurora.org>
parent 9704086e
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -295,7 +295,11 @@ static int create_cpu_lvl_nodes(struct lpm_cluster *p, struct kobject *parent)
			goto release_kobj;
		}

		for (i = 0; i < p->cpu->nlevels; i++) {
		/*
		 * Skip enable/disable for WFI. cpuidle expects WFI to be
		 * available at all times.
		 */
		for (i = 1; i < p->cpu->nlevels; i++) {

			ret = create_lvl_avail_nodes(p->cpu->levels[i].name,
					cpu_kobj[cpu_idx], &level_list[i],
+2 −2
Original line number Diff line number Diff line
/* Copyright (c) 2012-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
 * Copyright (C) 2006-2007 Adam Belay <abelay@novell.com>
 * Copyright (C) 2009 Intel Corporation
 *
@@ -1485,7 +1485,7 @@ static int lpm_cpuidle_select(struct cpuidle_driver *drv,
	idx = cpu_power_select(dev, cluster->cpu);

	if (idx < 0)
		return -EPERM;
		return 0;

	return idx;
}