Skip to content

Commit dc6b1ac

Browse files
committed
Blackfin: cleanup printk() usage in module code
Convert all printk() statements to use the common pr_xxx() funcs and use the new pr_fmt() function to standardize all of the output. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
1 parent 2253257 commit dc6b1ac

1 file changed

Lines changed: 25 additions & 34 deletions

File tree

‎arch/blackfin/kernel/module.c‎

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2828
*/
2929

30+
#define pr_fmt(fmt) "module %s: " fmt
3031

3132
#include <linux/moduleloader.h>
3233
#include <linux/elf.h>
@@ -72,9 +73,8 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
7273
dest = l1_inst_sram_alloc(s->sh_size);
7374
mod->arch.text_l1 = dest;
7475
if (dest == NULL) {
75-
printk(KERN_ERR
76-
"module %s: L1 instruction memory allocation failed\n",
77-
mod->name);
76+
pr_err("L1 inst memory allocation failed\n",
77+
mod->name);
7878
return -1;
7979
}
8080
dma_memcpy(dest, (void *)s->sh_addr, s->sh_size);
@@ -87,8 +87,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
8787
dest = l1_data_sram_alloc(s->sh_size);
8888
mod->arch.data_a_l1 = dest;
8989
if (dest == NULL) {
90-
printk(KERN_ERR
91-
"module %s: L1 data memory allocation failed\n",
90+
pr_err("L1 data memory allocation failed\n",
9291
mod->name);
9392
return -1;
9493
}
@@ -102,8 +101,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
102101
dest = l1_data_sram_alloc(s->sh_size);
103102
mod->arch.bss_a_l1 = dest;
104103
if (dest == NULL) {
105-
printk(KERN_ERR
106-
"module %s: L1 data memory allocation failed\n",
104+
pr_err("L1 data memory allocation failed\n",
107105
mod->name);
108106
return -1;
109107
}
@@ -115,8 +113,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
115113
dest = l1_data_B_sram_alloc(s->sh_size);
116114
mod->arch.data_b_l1 = dest;
117115
if (dest == NULL) {
118-
printk(KERN_ERR
119-
"module %s: L1 data memory allocation failed\n",
116+
pr_err("L1 data memory allocation failed\n",
120117
mod->name);
121118
return -1;
122119
}
@@ -128,8 +125,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
128125
dest = l1_data_B_sram_alloc(s->sh_size);
129126
mod->arch.bss_b_l1 = dest;
130127
if (dest == NULL) {
131-
printk(KERN_ERR
132-
"module %s: L1 data memory allocation failed\n",
128+
pr_err("L1 data memory allocation failed\n",
133129
mod->name);
134130
return -1;
135131
}
@@ -143,9 +139,8 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
143139
dest = l2_sram_alloc(s->sh_size);
144140
mod->arch.text_l2 = dest;
145141
if (dest == NULL) {
146-
printk(KERN_ERR
147-
"module %s: L2 SRAM allocation failed\n",
148-
mod->name);
142+
pr_err("L2 SRAM allocation failed\n",
143+
mod->name);
149144
return -1;
150145
}
151146
memcpy(dest, (void *)s->sh_addr, s->sh_size);
@@ -158,8 +153,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
158153
dest = l2_sram_alloc(s->sh_size);
159154
mod->arch.data_l2 = dest;
160155
if (dest == NULL) {
161-
printk(KERN_ERR
162-
"module %s: L2 SRAM allocation failed\n",
156+
pr_err("L2 SRAM allocation failed\n",
163157
mod->name);
164158
return -1;
165159
}
@@ -173,8 +167,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
173167
dest = l2_sram_alloc(s->sh_size);
174168
mod->arch.bss_l2 = dest;
175169
if (dest == NULL) {
176-
printk(KERN_ERR
177-
"module %s: L2 SRAM allocation failed\n",
170+
pr_err("L2 SRAM allocation failed\n",
178171
mod->name);
179172
return -1;
180173
}
@@ -190,7 +183,7 @@ int
190183
apply_relocate(Elf_Shdr * sechdrs, const char *strtab,
191184
unsigned int symindex, unsigned int relsec, struct module *me)
192185
{
193-
printk(KERN_ERR "module %s: .rel unsupported\n", me->name);
186+
pr_err(".rel unsupported\n", me->name);
194187
return -ENOEXEC;
195188
}
196189

@@ -217,8 +210,8 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab,
217210
uint16_t *location16;
218211
uint32_t value;
219212

220-
pr_debug("Applying relocate section %u to %u\n", relsec,
221-
sechdrs[relsec].sh_info);
213+
pr_debug("applying relocate section %u to %u\n", mod->name,
214+
relsec, sechdrs[relsec].sh_info);
222215
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
223216
/* This is where to make the change */
224217
location16 =
@@ -231,30 +224,29 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab,
231224
+ ELF32_R_SYM(rel[i].r_info);
232225
value = sym->st_value;
233226
value += rel[i].r_addend;
234-
pr_debug("location is %x, value is %x type is %d \n",
235-
(unsigned int) location32, value,
236-
ELF32_R_TYPE(rel[i].r_info));
227+
237228
#ifdef CONFIG_SMP
238229
if ((unsigned long)location16 >= COREB_L1_DATA_A_START) {
239-
printk(KERN_ERR "module %s: cannot relocate in L1: %u (SMP kernel)",
240-
mod->name, ELF32_R_TYPE(rel[i].r_info));
230+
pr_err("cannot relocate in L1: %u (SMP kernel)",
231+
mod->name, ELF32_R_TYPE(rel[i].r_info));
241232
return -ENOEXEC;
242233
}
243234
#endif
235+
236+
pr_debug("location is %lx, value is %x type is %d\n",
237+
mod->name, (unsigned long)location32, value,
238+
ELF32_R_TYPE(rel[i].r_info));
239+
244240
switch (ELF32_R_TYPE(rel[i].r_info)) {
245241

246242
case R_BFIN_LUIMM16:
247-
pr_debug("before %x after %x\n", *location16,
248-
(value & 0xffff));
249243
tmp = (value & 0xffff);
250244
if ((unsigned long)location16 >= L1_CODE_START) {
251245
dma_memcpy(location16, &tmp, 2);
252246
} else
253247
*location16 = tmp;
254248
break;
255249
case R_BFIN_HUIMM16:
256-
pr_debug("before %x after %x\n", *location16,
257-
((value >> 16) & 0xffff));
258250
tmp = ((value >> 16) & 0xffff);
259251
if ((unsigned long)location16 >= L1_CODE_START) {
260252
dma_memcpy(location16, &tmp, 2);
@@ -265,20 +257,19 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab,
265257
*location16 = (value & 0xffff);
266258
break;
267259
case R_BFIN_BYTE4_DATA:
268-
pr_debug("before %x after %x\n", *location32, value);
269260
*location32 = value;
270261
break;
271262
case R_BFIN_PCREL24:
272263
case R_BFIN_PCREL24_JUMP_L:
273264
case R_BFIN_PCREL12_JUMP:
274265
case R_BFIN_PCREL12_JUMP_S:
275266
case R_BFIN_PCREL10:
276-
printk(KERN_ERR "module %s: Unsupported relocation: %u (no -mlong-calls?)\n"
267+
pr_err("unsupported relocation: %u (no -mlong-calls?)\n",
277268
mod->name, ELF32_R_TYPE(rel[i].r_info));
278269
return -ENOEXEC;
279270
default:
280-
printk(KERN_ERR "module %s: Unknown relocation: %u\n",
281-
mod->name, ELF32_R_TYPE(rel[i].r_info));
271+
pr_err("unknown relocation: %u\n", mod->name,
272+
ELF32_R_TYPE(rel[i].r_info));
282273
return -ENOEXEC;
283274
}
284275
}

0 commit comments

Comments
 (0)