summaryrefslogtreecommitdiffstats
path: root/kernel/reboot.c
diff options
context:
space:
mode:
authorMatteo Croce <mcroce@microsoft.com>2020-12-16 05:47:04 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2020-12-16 07:46:19 +0100
commit1a9d079f43e3215b81ec13d427950093b8f04c70 (patch)
treea39e203f3d982bba086550d5d377876641543ebf /kernel/reboot.c
parentreboot: remove cf9_safe from allowed types and rename cf9_force (diff)
downloadlinux-1a9d079f43e3215b81ec13d427950093b8f04c70.tar.xz
linux-1a9d079f43e3215b81ec13d427950093b8f04c70.zip
reboot: allow to override reboot type if quirks are found
Patch series "reboot: sysfs improvements". Some improvements to the sysfs reboot interface: hide not working settings and support machines with known reboot quirks. This patch (of 2): On some machines a quirk can force a specific reboot type. Quirks are found during a DMI scan, the list of machines which need special reboot handling is defined in reboot_dmi_table. The kernel command line reboot= option overrides this via a global variable `reboot_default`, so that the reboot type requested in the command line is really performed. This was not true when setting the reboot type via the new sysfs interface. Fix this by setting reboot_default upon the first change, like reboot_setup() does for the command line. Link: https://lkml.kernel.org/r/20201130173717.198952-1-mcroce@linux.microsoft.com Link: https://lkml.kernel.org/r/20201130173717.198952-2-mcroce@linux.microsoft.com Signed-off-by: Matteo Croce <mcroce@microsoft.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r--kernel/reboot.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/reboot.c b/kernel/reboot.c
index 769ad55c7187..4a1a66452ec4 100644
--- a/kernel/reboot.c
+++ b/kernel/reboot.c
@@ -662,6 +662,8 @@ static ssize_t mode_store(struct kobject *kobj, struct kobj_attribute *attr,
else
return -EINVAL;
+ reboot_default = 0;
+
return count;
}
static struct kobj_attribute reboot_mode_attr = __ATTR_RW(mode);
@@ -716,6 +718,8 @@ static ssize_t type_store(struct kobject *kobj, struct kobj_attribute *attr,
else
return -EINVAL;
+ reboot_default = 0;
+
return count;
}
static struct kobj_attribute reboot_type_attr = __ATTR_RW(type);
@@ -741,6 +745,7 @@ static ssize_t cpu_store(struct kobject *kobj, struct kobj_attribute *attr,
if (cpunum >= num_possible_cpus())
return -ERANGE;
+ reboot_default = 0;
reboot_cpu = cpunum;
return count;
@@ -762,6 +767,7 @@ static ssize_t force_store(struct kobject *kobj, struct kobj_attribute *attr,
if (kstrtobool(buf, &res))
return -EINVAL;
+ reboot_default = 0;
reboot_force = res;
return count;