From: Vincent Donnefort Date: Tue, 16 Feb 2021 10:35:04 +0000 (+0000) Subject: cpu/hotplug: Allowing to reset fail injection X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=3ae70c251f344976428d1f6ee61ea7b4e170fec3;p=linux.git cpu/hotplug: Allowing to reset fail injection Currently, the only way of resetting the fail injection is to trigger a hotplug, hotunplug or both. This is rather annoying for testing and, as the default value for this file is -1, it seems pretty natural to let a user write it. Signed-off-by: Vincent Donnefort Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Ingo Molnar Link: https://lkml.kernel.org/r/20210216103506.416286-2-vincent.donnefort@arm.com --- diff --git a/kernel/cpu.c b/kernel/cpu.c index 1b6302ecbabe9..9121edf5759a5 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -2207,6 +2207,11 @@ static ssize_t write_cpuhp_fail(struct device *dev, if (ret) return ret; + if (fail == CPUHP_INVALID) { + st->fail = fail; + return count; + } + if (fail < CPUHP_OFFLINE || fail > CPUHP_ONLINE) return -EINVAL;