From 7ba791b2a72d128b793790f92352b1e8dac04ce6 Mon Sep 17 00:00:00 2001 From: Patrick Bellasi Date: Tue, 15 Sep 2015 10:21:25 +0100 Subject: [PATCH] hotplug: make hotplug probing more robust In general it makes not sense to hotplug out all the CPUs of a system, thus ususally CPU0 is configured as not hot/plugggable. Definitively, on a single core system it does not make sense to hotpolug out the only available CPU. This patch switch to usage of CPU1 for hotplug support probing, which is the really first one for which enabling hotplug could be useful. Signed-off-by: Patrick Bellasi --- devlib/module/hotplug.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/devlib/module/hotplug.py b/devlib/module/hotplug.py index d89ce07..8ae238e 100644 --- a/devlib/module/hotplug.py +++ b/devlib/module/hotplug.py @@ -8,7 +8,10 @@ class HotplugModule(Module): @classmethod def probe(cls, target): # pylint: disable=arguments-differ - path = cls._cpu_path(target, 0) + # If a system has just 1 CPU, it makes not sense to hotplug it. + # If a system has more than 1 CPU, CPU0 could be configured to be not + # hotpluggable. Thus, check for hotplug support by looking at CPU1 + path = cls._cpu_path(target, 1) return target.file_exists(path) and target.is_rooted @classmethod @@ -30,6 +33,8 @@ class HotplugModule(Module): def hotplug(self, cpu, online): path = self._cpu_path(self.target, cpu) + if not self.target.file_exists(path): + return value = 1 if online else 0 self.target.write_value(path, value)