Skip to content

Commit 6d3cf96

Browse files
committed
printk: Collapse shutdown types into a single dump reason
To turn the KMSG_DUMP_* reasons into a more ordered list, collapse the redundant KMSG_DUMP_(RESTART|HALT|POWEROFF) reasons into KMSG_DUMP_SHUTDOWN. The current users already don't meaningfully distinguish between them, so there's no need to, as discussed here: https://lore.kernel.org/lkml/CA+CK2bAPv5u1ih5y9t5FUnTyximtFCtDYXJCpuyjOyHNOkRdqw@mail.gmail.com/ Link: https://lore.kernel.org/lkml/[email protected]/ Reviewed-by: Pavel Tatashin <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Acked-by: Michael Ellerman <[email protected]> (powerpc) Signed-off-by: Kees Cook <[email protected]>
1 parent 16a5830 commit 6d3cf96

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

arch/powerpc/kernel/nvram_64.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,9 +655,7 @@ static void oops_to_nvram(struct kmsg_dumper *dumper,
655655
int rc = -1;
656656

657657
switch (reason) {
658-
case KMSG_DUMP_RESTART:
659-
case KMSG_DUMP_HALT:
660-
case KMSG_DUMP_POWEROFF:
658+
case KMSG_DUMP_SHUTDOWN:
661659
/* These are almost always orderly shutdowns. */
662660
return;
663661
case KMSG_DUMP_OOPS:

fs/pstore/platform.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,8 @@ static const char *get_reason_str(enum kmsg_dump_reason reason)
144144
return "Oops";
145145
case KMSG_DUMP_EMERG:
146146
return "Emergency";
147-
case KMSG_DUMP_RESTART:
148-
return "Restart";
149-
case KMSG_DUMP_HALT:
150-
return "Halt";
151-
case KMSG_DUMP_POWEROFF:
152-
return "Poweroff";
147+
case KMSG_DUMP_SHUTDOWN:
148+
return "Shutdown";
153149
default:
154150
return "Unknown";
155151
}

include/linux/kmsg_dump.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ enum kmsg_dump_reason {
2525
KMSG_DUMP_PANIC,
2626
KMSG_DUMP_OOPS,
2727
KMSG_DUMP_EMERG,
28-
KMSG_DUMP_RESTART,
29-
KMSG_DUMP_HALT,
30-
KMSG_DUMP_POWEROFF,
28+
KMSG_DUMP_SHUTDOWN,
3129
};
3230

3331
/**

kernel/reboot.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void kernel_restart(char *cmd)
250250
pr_emerg("Restarting system\n");
251251
else
252252
pr_emerg("Restarting system with command '%s'\n", cmd);
253-
kmsg_dump(KMSG_DUMP_RESTART);
253+
kmsg_dump(KMSG_DUMP_SHUTDOWN);
254254
machine_restart(cmd);
255255
}
256256
EXPORT_SYMBOL_GPL(kernel_restart);
@@ -274,7 +274,7 @@ void kernel_halt(void)
274274
migrate_to_reboot_cpu();
275275
syscore_shutdown();
276276
pr_emerg("System halted\n");
277-
kmsg_dump(KMSG_DUMP_HALT);
277+
kmsg_dump(KMSG_DUMP_SHUTDOWN);
278278
machine_halt();
279279
}
280280
EXPORT_SYMBOL_GPL(kernel_halt);
@@ -292,7 +292,7 @@ void kernel_power_off(void)
292292
migrate_to_reboot_cpu();
293293
syscore_shutdown();
294294
pr_emerg("Power down\n");
295-
kmsg_dump(KMSG_DUMP_POWEROFF);
295+
kmsg_dump(KMSG_DUMP_SHUTDOWN);
296296
machine_power_off();
297297
}
298298
EXPORT_SYMBOL_GPL(kernel_power_off);

0 commit comments

Comments
 (0)