Skip to content

Commit

Permalink
reboot: allow to override reboot type if quirks are found
Browse files Browse the repository at this point in the history
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/[email protected]
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Matteo Croce <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
teknoraver authored and torvalds committed Dec 16, 2020
1 parent 0c5c017 commit 1a9d079
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kernel/reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 1a9d079

Please sign in to comment.