cpuidle: menu: Use one loop for average and variance computations
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 6 Feb 2025 14:24:18 +0000 (15:24 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 25 Feb 2025 11:00:17 +0000 (12:00 +0100)
commit13982929fb08ed4691256072856f50bf7b206b9b
tree58f498128be522ca8808692d2d918ac60146a663
parentd2cd195b57cf5ffbe432be01e96f35637e7bd403
cpuidle: menu: Use one loop for average and variance computations

Use the observation that one loop is sufficient to compute the average
of an array of values and their variance to eliminate one of the loops
from get_typical_interval().

While at it, make get_typical_interval() consistently use u64 as the
64-bit unsigned integer data type and rearrange some white space and the
declarations of local variables in it (to make them follow the reverse
X-mas tree pattern).

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Reviewed-by: Christian Loehle <christian.loehle@arm.com>
Tested-by: Christian Loehle <christian.loehle@arm.com>
Tested-by: Aboorva Devarajan <aboorvad@linux.ibm.com>
Link: https://patch.msgid.link/3339073.aeNJFYEL58@rjwysocki.net
drivers/cpuidle/governors/menu.c