aboutsummaryrefslogtreecommitdiffstats
path: root/arch/tile/kernel/machine_kexec.c
diff options
context:
space:
mode:
authorChris Metcalf <cmetcalf@tilera.com>2010-06-25 17:04:17 -0400
committerChris Metcalf <cmetcalf@tilera.com>2010-07-06 13:41:51 -0400
commit0707ad30d10110aebc01a5a64fb63f4b32d20b73 (patch)
tree64d8ba73e605ac26e56808d1d77701b3f83cf8b2 /arch/tile/kernel/machine_kexec.c
parentc78095bd8c77fca2619769ff8efb639fd100e373 (diff)
arch/tile: Miscellaneous cleanup changes.
This commit is primarily changes caused by reviewing "sparse" and "checkpatch" output on our sources, so is somewhat noisy, since things like "printk() -> pr_err()" (or whatever) throughout the codebase tend to get tedious to read. Rather than trying to tease apart precisely which things changed due to which type of code review, this commit includes various cleanups in the code: - sparse: Add declarations in headers for globals. - sparse: Fix __user annotations. - sparse: Using gfp_t consistently instead of int. - sparse: removing functions not actually used. - checkpatch: Clean up printk() warnings by using pr_info(), etc.; also avoid partial-line printks except in bootup code. - checkpatch: Use exposed structs rather than typedefs. - checkpatch: Change some C99 comments to C89 comments. In addition, a couple of minor other changes are rolled in to this commit: - Add support for a "raise" instruction to cause SIGFPE, etc., to be raised. - Remove some compat code that is unnecessary when we fully eliminate some of the deprecated syscalls from the generic syscall ABI. - Update the tile_defconfig to reflect current config contents. Signed-off-by: Chris Metcalf <cmetcalf@tilera.com> Acked-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'arch/tile/kernel/machine_kexec.c')
-rw-r--r--arch/tile/kernel/machine_kexec.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/arch/tile/kernel/machine_kexec.c b/arch/tile/kernel/machine_kexec.c
index ed3e1cb8dcc4..ba7a265d6179 100644
--- a/arch/tile/kernel/machine_kexec.c
+++ b/arch/tile/kernel/machine_kexec.c
@@ -75,13 +75,13 @@ void machine_crash_shutdown(struct pt_regs *regs)
75int machine_kexec_prepare(struct kimage *image) 75int machine_kexec_prepare(struct kimage *image)
76{ 76{
77 if (num_online_cpus() > 1) { 77 if (num_online_cpus() > 1) {
78 printk(KERN_WARNING "%s: detected attempt to kexec " 78 pr_warning("%s: detected attempt to kexec "
79 "with num_online_cpus() > 1\n", 79 "with num_online_cpus() > 1\n",
80 __func__); 80 __func__);
81 return -ENOSYS; 81 return -ENOSYS;
82 } 82 }
83 if (image->type != KEXEC_TYPE_DEFAULT) { 83 if (image->type != KEXEC_TYPE_DEFAULT) {
84 printk(KERN_WARNING "%s: detected attempt to kexec " 84 pr_warning("%s: detected attempt to kexec "
85 "with unsupported type: %d\n", 85 "with unsupported type: %d\n",
86 __func__, 86 __func__,
87 image->type); 87 image->type);
@@ -124,22 +124,13 @@ static unsigned char *kexec_bn2cl(void *pg)
124 return 0; 124 return 0;
125 125
126 /* 126 /*
127 * If we get a checksum mismatch, it's possible that this is 127 * If we get a checksum mismatch, warn with the checksum
128 * just a false positive, but relatively unlikely. We dump 128 * so we can diagnose better.
129 * out the contents of the section so we can diagnose better.
130 */ 129 */
131 csum = ip_compute_csum(pg, bhdrp->b_size); 130 csum = ip_compute_csum(pg, bhdrp->b_size);
132 if (csum != 0) { 131 if (csum != 0) {
133 int i; 132 pr_warning("%s: bad checksum %#x (size %d)\n",
134 unsigned char *p = pg; 133 __func__, csum, bhdrp->b_size);
135 int nbytes = min((Elf32_Word)1000, bhdrp->b_size);
136 printk(KERN_INFO "%s: bad checksum %#x\n", __func__, csum);
137 printk(KERN_INFO "bytes (%d):", bhdrp->b_size);
138 for (i = 0; i < nbytes; ++i)
139 printk(" %02x", p[i]);
140 if (bhdrp->b_size != nbytes)
141 printk(" ...");
142 printk("\n");
143 return 0; 134 return 0;
144 } 135 }
145 136
@@ -156,7 +147,7 @@ static unsigned char *kexec_bn2cl(void *pg)
156 if ((unsigned char *) (nhdrp + 1) > 147 if ((unsigned char *) (nhdrp + 1) >
157 ((unsigned char *) pg) + bhdrp->b_size) { 148 ((unsigned char *) pg) + bhdrp->b_size) {
158 149
159 printk(KERN_INFO "%s: out of bounds\n", __func__); 150 pr_info("%s: out of bounds\n", __func__);
160 return 0; 151 return 0;
161 } 152 }
162 } 153 }
@@ -167,7 +158,7 @@ static unsigned char *kexec_bn2cl(void *pg)
167 while (*desc != '\0') { 158 while (*desc != '\0') {
168 desc++; 159 desc++;
169 if (((unsigned long)desc & PAGE_MASK) != (unsigned long)pg) { 160 if (((unsigned long)desc & PAGE_MASK) != (unsigned long)pg) {
170 printk(KERN_INFO "%s: ran off end of page\n", 161 pr_info("%s: ran off end of page\n",
171 __func__); 162 __func__);
172 return 0; 163 return 0;
173 } 164 }
@@ -202,23 +193,20 @@ static void kexec_find_and_set_command_line(struct kimage *image)
202 } 193 }
203 194
204 if (command_line != 0) { 195 if (command_line != 0) {
205 printk(KERN_INFO "setting new command line to \"%s\"\n", 196 pr_info("setting new command line to \"%s\"\n",
206 command_line); 197 command_line);
207 198
208 hverr = hv_set_command_line( 199 hverr = hv_set_command_line(
209 (HV_VirtAddr) command_line, strlen(command_line)); 200 (HV_VirtAddr) command_line, strlen(command_line));
210 kunmap_atomic(command_line, KM_USER0); 201 kunmap_atomic(command_line, KM_USER0);
211 } else { 202 } else {
212 printk(KERN_INFO "%s: no command line found; making empty\n", 203 pr_info("%s: no command line found; making empty\n",
213 __func__); 204 __func__);
214 hverr = hv_set_command_line((HV_VirtAddr) command_line, 0); 205 hverr = hv_set_command_line((HV_VirtAddr) command_line, 0);
215 } 206 }
216 if (hverr) { 207 if (hverr)
217 printk(KERN_WARNING 208 pr_warning("%s: hv_set_command_line returned error: %d\n",
218 "%s: call to hv_set_command_line returned error: %d\n", 209 __func__, hverr);
219 __func__, hverr);
220
221 }
222} 210}
223 211
224/* 212/*