diff options
author | Robin Holt <holt@sgi.com> | 2013-07-08 19:01:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-09 13:33:29 -0400 |
commit | 972ee83df88a7fd84c228a31b4f9611299898984 (patch) | |
tree | 7afd86b1ee5809ed6d8390be11c550b176effed8 /kernel | |
parent | 15d94b82565ebfb0cf27830b96e6cf5ed2d12a9a (diff) |
reboot: checkpatch.pl the new kernel/reboot.c file
Get the new file to pass scripts/checkpatch.pl
Signed-off-by: Robin Holt <holt@sgi.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Russ Anderson <rja@sgi.com>
Cc: Robin Holt <holt@sgi.com>
Cc: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/reboot.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/kernel/reboot.c b/kernel/reboot.c index 37d2636a65c2..abb6a0483716 100644 --- a/kernel/reboot.c +++ b/kernel/reboot.c | |||
@@ -4,6 +4,8 @@ | |||
4 | * Copyright (C) 2013 Linus Torvalds | 4 | * Copyright (C) 2013 Linus Torvalds |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #define pr_fmt(fmt) "reboot: " fmt | ||
8 | |||
7 | #include <linux/export.h> | 9 | #include <linux/export.h> |
8 | #include <linux/kexec.h> | 10 | #include <linux/kexec.h> |
9 | #include <linux/kmod.h> | 11 | #include <linux/kmod.h> |
@@ -114,9 +116,9 @@ void kernel_restart(char *cmd) | |||
114 | migrate_to_reboot_cpu(); | 116 | migrate_to_reboot_cpu(); |
115 | syscore_shutdown(); | 117 | syscore_shutdown(); |
116 | if (!cmd) | 118 | if (!cmd) |
117 | printk(KERN_EMERG "Restarting system.\n"); | 119 | pr_emerg("Restarting system\n"); |
118 | else | 120 | else |
119 | printk(KERN_EMERG "Restarting system with command '%s'.\n", cmd); | 121 | pr_emerg("Restarting system with command '%s'\n", cmd); |
120 | kmsg_dump(KMSG_DUMP_RESTART); | 122 | kmsg_dump(KMSG_DUMP_RESTART); |
121 | machine_restart(cmd); | 123 | machine_restart(cmd); |
122 | } | 124 | } |
@@ -125,7 +127,7 @@ EXPORT_SYMBOL_GPL(kernel_restart); | |||
125 | static void kernel_shutdown_prepare(enum system_states state) | 127 | static void kernel_shutdown_prepare(enum system_states state) |
126 | { | 128 | { |
127 | blocking_notifier_call_chain(&reboot_notifier_list, | 129 | blocking_notifier_call_chain(&reboot_notifier_list, |
128 | (state == SYSTEM_HALT)?SYS_HALT:SYS_POWER_OFF, NULL); | 130 | (state == SYSTEM_HALT) ? SYS_HALT : SYS_POWER_OFF, NULL); |
129 | system_state = state; | 131 | system_state = state; |
130 | usermodehelper_disable(); | 132 | usermodehelper_disable(); |
131 | device_shutdown(); | 133 | device_shutdown(); |
@@ -140,11 +142,10 @@ void kernel_halt(void) | |||
140 | kernel_shutdown_prepare(SYSTEM_HALT); | 142 | kernel_shutdown_prepare(SYSTEM_HALT); |
141 | migrate_to_reboot_cpu(); | 143 | migrate_to_reboot_cpu(); |
142 | syscore_shutdown(); | 144 | syscore_shutdown(); |
143 | printk(KERN_EMERG "System halted.\n"); | 145 | pr_emerg("System halted\n"); |
144 | kmsg_dump(KMSG_DUMP_HALT); | 146 | kmsg_dump(KMSG_DUMP_HALT); |
145 | machine_halt(); | 147 | machine_halt(); |
146 | } | 148 | } |
147 | |||
148 | EXPORT_SYMBOL_GPL(kernel_halt); | 149 | EXPORT_SYMBOL_GPL(kernel_halt); |
149 | 150 | ||
150 | /** | 151 | /** |
@@ -159,7 +160,7 @@ void kernel_power_off(void) | |||
159 | pm_power_off_prepare(); | 160 | pm_power_off_prepare(); |
160 | migrate_to_reboot_cpu(); | 161 | migrate_to_reboot_cpu(); |
161 | syscore_shutdown(); | 162 | syscore_shutdown(); |
162 | printk(KERN_EMERG "Power down.\n"); | 163 | pr_emerg("Power down\n"); |
163 | kmsg_dump(KMSG_DUMP_POWEROFF); | 164 | kmsg_dump(KMSG_DUMP_POWEROFF); |
164 | machine_power_off(); | 165 | machine_power_off(); |
165 | } | 166 | } |
@@ -188,10 +189,10 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, | |||
188 | 189 | ||
189 | /* For safety, we require "magic" arguments. */ | 190 | /* For safety, we require "magic" arguments. */ |
190 | if (magic1 != LINUX_REBOOT_MAGIC1 || | 191 | if (magic1 != LINUX_REBOOT_MAGIC1 || |
191 | (magic2 != LINUX_REBOOT_MAGIC2 && | 192 | (magic2 != LINUX_REBOOT_MAGIC2 && |
192 | magic2 != LINUX_REBOOT_MAGIC2A && | 193 | magic2 != LINUX_REBOOT_MAGIC2A && |
193 | magic2 != LINUX_REBOOT_MAGIC2B && | 194 | magic2 != LINUX_REBOOT_MAGIC2B && |
194 | magic2 != LINUX_REBOOT_MAGIC2C)) | 195 | magic2 != LINUX_REBOOT_MAGIC2C)) |
195 | return -EINVAL; | 196 | return -EINVAL; |
196 | 197 | ||
197 | /* | 198 | /* |
@@ -234,7 +235,8 @@ SYSCALL_DEFINE4(reboot, int, magic1, int, magic2, unsigned int, cmd, | |||
234 | break; | 235 | break; |
235 | 236 | ||
236 | case LINUX_REBOOT_CMD_RESTART2: | 237 | case LINUX_REBOOT_CMD_RESTART2: |
237 | if (strncpy_from_user(&buffer[0], arg, sizeof(buffer) - 1) < 0) { | 238 | ret = strncpy_from_user(&buffer[0], arg, sizeof(buffer) - 1); |
239 | if (ret < 0) { | ||
238 | ret = -EFAULT; | 240 | ret = -EFAULT; |
239 | break; | 241 | break; |
240 | } | 242 | } |
@@ -300,14 +302,11 @@ static int __orderly_poweroff(bool force) | |||
300 | ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); | 302 | ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); |
301 | argv_free(argv); | 303 | argv_free(argv); |
302 | } else { | 304 | } else { |
303 | printk(KERN_WARNING "%s failed to allocate memory for \"%s\"\n", | ||
304 | __func__, poweroff_cmd); | ||
305 | ret = -ENOMEM; | 305 | ret = -ENOMEM; |
306 | } | 306 | } |
307 | 307 | ||
308 | if (ret && force) { | 308 | if (ret && force) { |
309 | printk(KERN_WARNING "Failed to start orderly shutdown: " | 309 | pr_warn("Failed to start orderly shutdown: forcing the issue\n"); |
310 | "forcing the issue\n"); | ||
311 | /* | 310 | /* |
312 | * I guess this should try to kick off some daemon to sync and | 311 | * I guess this should try to kick off some daemon to sync and |
313 | * poweroff asap. Or not even bother syncing if we're doing an | 312 | * poweroff asap. Or not even bother syncing if we're doing an |