From: Matteo Croce Date: Wed, 16 Dec 2020 04:47:00 +0000 (-0800) Subject: reboot: remove cf9_safe from allowed types and rename cf9_force X-Git-Tag: io_uring-5.11-2020-12-23~43^2~8 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=0c5c0179e2cddb0d1c52ba1487f9f9e77714c8af;p=linux-2.6-block.git reboot: remove cf9_safe from allowed types and rename cf9_force BOOT_CF9_SAFE_STR is an internal value used only by the x86 code and it's not possible to set it from userspace. Remove it, and rename 'cf9_force' to 'pci', so to make it coherent with the kernel command line reboot= option. Tested with this script: cd /sys/kernel/reboot/ for i in cold warm hard soft gpio; do echo $i >mode read j type read j cpu read j force read j Cc: Arnd Bergmann Cc: Guenter Roeck Cc: Kees Cook Cc: Mike Rapoport Cc: Nathan Chancellor Cc: Pavel Tatashin Cc: Petr Mladek Cc: Tyler Hicks Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/reboot.c b/kernel/reboot.c index 940cbb784e17..769ad55c7187 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c @@ -615,8 +615,7 @@ __setup("reboot=", reboot_setup); #define BOOT_BIOS_STR "bios" #define BOOT_ACPI_STR "acpi" #define BOOT_EFI_STR "efi" -#define BOOT_CF9_FORCE_STR "cf9_force" -#define BOOT_CF9_SAFE_STR "cf9_safe" +#define BOOT_PCI_STR "pci" static ssize_t mode_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { @@ -688,10 +687,7 @@ static ssize_t type_show(struct kobject *kobj, struct kobj_attribute *attr, char val = BOOT_EFI_STR; break; case BOOT_CF9_FORCE: - val = BOOT_CF9_FORCE_STR; - break; - case BOOT_CF9_SAFE: - val = BOOT_CF9_SAFE_STR; + val = BOOT_PCI_STR; break; default: val = REBOOT_UNDEFINED_STR; @@ -715,10 +711,8 @@ static ssize_t type_store(struct kobject *kobj, struct kobj_attribute *attr, reboot_type = BOOT_ACPI; else if (!strncmp(buf, BOOT_EFI_STR, strlen(BOOT_EFI_STR))) reboot_type = BOOT_EFI; - else if (!strncmp(buf, BOOT_CF9_FORCE_STR, strlen(BOOT_CF9_FORCE_STR))) + else if (!strncmp(buf, BOOT_PCI_STR, strlen(BOOT_PCI_STR))) reboot_type = BOOT_CF9_FORCE; - else if (!strncmp(buf, BOOT_CF9_SAFE_STR, strlen(BOOT_CF9_SAFE_STR))) - reboot_type = BOOT_CF9_SAFE; else return -EINVAL;