From b8f7b247903d77d5a5076fc88315f07f3045da88 Mon Sep 17 00:00:00 2001
From: Valentin Schneider <valentin.schneider@arm.com>
Date: Tue, 9 Jul 2019 14:15:58 +0100
Subject: [PATCH] module/sched: Fix incorrect SchedProcFSData usage

Rather than using the conveniently provided `get_cpu_sd_info()` helper
method, `has_em()` and `get_em_capacity()` would build a
`SchedProcFSData` with `path=<CPU number>`, which is obviously broken.

Do the right thing and use `get_cpu_sd_info()` in those places.
---
 devlib/module/sched.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/devlib/module/sched.py b/devlib/module/sched.py
index d4be38c..405f92c 100644
--- a/devlib/module/sched.py
+++ b/devlib/module/sched.py
@@ -393,7 +393,7 @@ class SchedModule(Module):
         :returns: Whether energy model data is available for 'cpu'
         """
         if not sd:
-            sd = SchedProcFSData(self.target, cpu)
+            sd = self.get_cpu_sd_info(cpu)
 
         return sd.procfs["domain0"].get("group0", {}).get("energy", {}).get("cap_states") != None
 
@@ -412,7 +412,7 @@ class SchedModule(Module):
         :returns: The maximum capacity value exposed by the EAS energy model
         """
         if not sd:
-            sd = SchedProcFSData(self.target, cpu)
+            sd = self.get_cpu_sd_info(cpu)
 
         cap_states = sd.domains[0].groups[0].energy.cap_states
         cap_states_list = cap_states.split('\t')