History

reboot: Fix build warning without CONFIG_SYSCTL

If CONFIG_SYSCTL is n, build warn: kernel/reboot.c:443:20: error: ‘kernel_reboot_sysctls_init’ defined but not used [-Werror=unused-function] static void __init kernel_reboot_sysctls_init(void) ^~~~~~~~~~~~~~~~~~~~~~~~~~ Move kernel_reboot_sysctls_init() to #ifdef block to fix this.

YueHaibing committed 4 years ago

Commit 764aaf41 parent a4672571 file · +27 −27Browse files

Unified · Split

kernel/reboot.c+27−27
@@ -421,33 +421,6 @@ void ctrl_alt_del(void) · 420 unmodified lines
421static char poweroff_cmd[POWEROFF_CMD_PATH_LEN] = "/sbin/poweroff";421static char poweroff_cmd[POWEROFF_CMD_PATH_LEN] = "/sbin/poweroff";
422static const char reboot_cmd[] = "/sbin/reboot";422static const char reboot_cmd[] = "/sbin/reboot";
423 423
424#ifdef CONFIG_SYSCTL
425static struct ctl_table kern_reboot_table[] = {
426 {
427 .procname = "poweroff_cmd",
428 .data = &poweroff_cmd,
429 .maxlen = POWEROFF_CMD_PATH_LEN,
430 .mode = 0644,
431 .proc_handler = proc_dostring,
432 },
433 {
434 .procname = "ctrl-alt-del",
435 .data = &C_A_D,
436 .maxlen = sizeof(int),
437 .mode = 0644,
438 .proc_handler = proc_dointvec,
439 },
440 { }
441};
442
443static void __init kernel_reboot_sysctls_init(void)
444{
445 register_sysctl_init("kernel", kern_reboot_table);
446}
447#else
448#define kernel_reboot_sysctls_init() do { } while (0)
449#endif /* CONFIG_SYSCTL */
450
451static int run_cmd(const char *cmd)424static int run_cmd(const char *cmd)
452{425{
453 char **argv;426 char **argv;
@@ -895,6 +868,33 @@ static struct attribute *reboot_attrs[] = { · 441 unmodified lines
895 NULL,868 NULL,
896};869};
897 870
871#ifdef CONFIG_SYSCTL
872static struct ctl_table kern_reboot_table[] = {
873 {
874 .procname = "poweroff_cmd",
875 .data = &poweroff_cmd,
876 .maxlen = POWEROFF_CMD_PATH_LEN,
877 .mode = 0644,
878 .proc_handler = proc_dostring,
879 },
880 {
881 .procname = "ctrl-alt-del",
882 .data = &C_A_D,
883 .maxlen = sizeof(int),
884 .mode = 0644,
885 .proc_handler = proc_dointvec,
886 },
887 { }
888};
889
890static void __init kernel_reboot_sysctls_init(void)
891{
892 register_sysctl_init("kernel", kern_reboot_table);
893}
894#else
895#define kernel_reboot_sysctls_init() do { } while (0)
896#endif /* CONFIG_SYSCTL */
897
898static const struct attribute_group reboot_attr_group = {898static const struct attribute_group reboot_attr_group = {
899 .attrs = reboot_attrs,899 .attrs = reboot_attrs,
900};900};