From 6fe78b4d47861bc8234f80bcc293168e32340a23 Mon Sep 17 00:00:00 2001 From: Douglas RAILLARD Date: Wed, 15 Jan 2020 11:32:44 +0000 Subject: [PATCH] module/cpufreq: Sort list of frequencies Ensure the order of frequencies is deterministic to have consistent output when printing it or when using it to carry out some actions. --- devlib/module/cpufreq.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devlib/module/cpufreq.py b/devlib/module/cpufreq.py index 32e0ef5..1c347d0 100644 --- a/devlib/module/cpufreq.py +++ b/devlib/module/cpufreq.py @@ -212,7 +212,7 @@ class CpufreqModule(Module): @memoized def list_frequencies(self, cpu): - """Returns a list of frequencies supported by the cpu or an empty list + """Returns a sorted list of frequencies supported by the cpu or an empty list if not could be found.""" if isinstance(cpu, int): cpu = 'cpu{}'.format(cpu) @@ -234,7 +234,7 @@ class CpufreqModule(Module): raise available_frequencies = list(map(int, reversed([f for f, _ in zip(out_iter, out_iter)]))) - return available_frequencies + return sorted(available_frequencies) @memoized def get_max_available_frequency(self, cpu):