Commit dc6b1ac9 authored by Mike Frysinger's avatar Mike Frysinger

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: default avatarMike Frysinger <vapier@gentoo.org>
parent 22532578
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
#define pr_fmt(fmt) "module %s: " fmt
#include <linux/moduleloader.h> #include <linux/moduleloader.h>
#include <linux/elf.h> #include <linux/elf.h>
...@@ -72,8 +73,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, ...@@ -72,8 +73,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
dest = l1_inst_sram_alloc(s->sh_size); dest = l1_inst_sram_alloc(s->sh_size);
mod->arch.text_l1 = dest; mod->arch.text_l1 = dest;
if (dest == NULL) { if (dest == NULL) {
printk(KERN_ERR pr_err("L1 inst memory allocation failed\n",
"module %s: L1 instruction memory allocation failed\n",
mod->name); mod->name);
return -1; return -1;
} }
...@@ -87,8 +87,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, ...@@ -87,8 +87,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
dest = l1_data_sram_alloc(s->sh_size); dest = l1_data_sram_alloc(s->sh_size);
mod->arch.data_a_l1 = dest; mod->arch.data_a_l1 = dest;
if (dest == NULL) { if (dest == NULL) {
printk(KERN_ERR pr_err("L1 data memory allocation failed\n",
"module %s: L1 data memory allocation failed\n",
mod->name); mod->name);
return -1; return -1;
} }
...@@ -102,8 +101,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, ...@@ -102,8 +101,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
dest = l1_data_sram_alloc(s->sh_size); dest = l1_data_sram_alloc(s->sh_size);
mod->arch.bss_a_l1 = dest; mod->arch.bss_a_l1 = dest;
if (dest == NULL) { if (dest == NULL) {
printk(KERN_ERR pr_err("L1 data memory allocation failed\n",
"module %s: L1 data memory allocation failed\n",
mod->name); mod->name);
return -1; return -1;
} }
...@@ -115,8 +113,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, ...@@ -115,8 +113,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
dest = l1_data_B_sram_alloc(s->sh_size); dest = l1_data_B_sram_alloc(s->sh_size);
mod->arch.data_b_l1 = dest; mod->arch.data_b_l1 = dest;
if (dest == NULL) { if (dest == NULL) {
printk(KERN_ERR pr_err("L1 data memory allocation failed\n",
"module %s: L1 data memory allocation failed\n",
mod->name); mod->name);
return -1; return -1;
} }
...@@ -128,8 +125,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, ...@@ -128,8 +125,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
dest = l1_data_B_sram_alloc(s->sh_size); dest = l1_data_B_sram_alloc(s->sh_size);
mod->arch.bss_b_l1 = dest; mod->arch.bss_b_l1 = dest;
if (dest == NULL) { if (dest == NULL) {
printk(KERN_ERR pr_err("L1 data memory allocation failed\n",
"module %s: L1 data memory allocation failed\n",
mod->name); mod->name);
return -1; return -1;
} }
...@@ -143,8 +139,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, ...@@ -143,8 +139,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
dest = l2_sram_alloc(s->sh_size); dest = l2_sram_alloc(s->sh_size);
mod->arch.text_l2 = dest; mod->arch.text_l2 = dest;
if (dest == NULL) { if (dest == NULL) {
printk(KERN_ERR pr_err("L2 SRAM allocation failed\n",
"module %s: L2 SRAM allocation failed\n",
mod->name); mod->name);
return -1; return -1;
} }
...@@ -158,8 +153,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, ...@@ -158,8 +153,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
dest = l2_sram_alloc(s->sh_size); dest = l2_sram_alloc(s->sh_size);
mod->arch.data_l2 = dest; mod->arch.data_l2 = dest;
if (dest == NULL) { if (dest == NULL) {
printk(KERN_ERR pr_err("L2 SRAM allocation failed\n",
"module %s: L2 SRAM allocation failed\n",
mod->name); mod->name);
return -1; return -1;
} }
...@@ -173,8 +167,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs, ...@@ -173,8 +167,7 @@ module_frob_arch_sections(Elf_Ehdr * hdr, Elf_Shdr * sechdrs,
dest = l2_sram_alloc(s->sh_size); dest = l2_sram_alloc(s->sh_size);
mod->arch.bss_l2 = dest; mod->arch.bss_l2 = dest;
if (dest == NULL) { if (dest == NULL) {
printk(KERN_ERR pr_err("L2 SRAM allocation failed\n",
"module %s: L2 SRAM allocation failed\n",
mod->name); mod->name);
return -1; return -1;
} }
...@@ -190,7 +183,7 @@ int ...@@ -190,7 +183,7 @@ int
apply_relocate(Elf_Shdr * sechdrs, const char *strtab, apply_relocate(Elf_Shdr * sechdrs, const char *strtab,
unsigned int symindex, unsigned int relsec, struct module *me) unsigned int symindex, unsigned int relsec, struct module *me)
{ {
printk(KERN_ERR "module %s: .rel unsupported\n", me->name); pr_err(".rel unsupported\n", me->name);
return -ENOEXEC; return -ENOEXEC;
} }
...@@ -217,8 +210,8 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab, ...@@ -217,8 +210,8 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab,
uint16_t *location16; uint16_t *location16;
uint32_t value; uint32_t value;
pr_debug("Applying relocate section %u to %u\n", relsec, pr_debug("applying relocate section %u to %u\n", mod->name,
sechdrs[relsec].sh_info); relsec, sechdrs[relsec].sh_info);
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) { for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
/* This is where to make the change */ /* This is where to make the change */
location16 = location16 =
...@@ -231,21 +224,22 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab, ...@@ -231,21 +224,22 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab,
+ ELF32_R_SYM(rel[i].r_info); + ELF32_R_SYM(rel[i].r_info);
value = sym->st_value; value = sym->st_value;
value += rel[i].r_addend; value += rel[i].r_addend;
pr_debug("location is %x, value is %x type is %d \n",
(unsigned int) location32, value,
ELF32_R_TYPE(rel[i].r_info));
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
if ((unsigned long)location16 >= COREB_L1_DATA_A_START) { if ((unsigned long)location16 >= COREB_L1_DATA_A_START) {
printk(KERN_ERR "module %s: cannot relocate in L1: %u (SMP kernel)", pr_err("cannot relocate in L1: %u (SMP kernel)",
mod->name, ELF32_R_TYPE(rel[i].r_info)); mod->name, ELF32_R_TYPE(rel[i].r_info));
return -ENOEXEC; return -ENOEXEC;
} }
#endif #endif
pr_debug("location is %lx, value is %x type is %d\n",
mod->name, (unsigned long)location32, value,
ELF32_R_TYPE(rel[i].r_info));
switch (ELF32_R_TYPE(rel[i].r_info)) { switch (ELF32_R_TYPE(rel[i].r_info)) {
case R_BFIN_LUIMM16: case R_BFIN_LUIMM16:
pr_debug("before %x after %x\n", *location16,
(value & 0xffff));
tmp = (value & 0xffff); tmp = (value & 0xffff);
if ((unsigned long)location16 >= L1_CODE_START) { if ((unsigned long)location16 >= L1_CODE_START) {
dma_memcpy(location16, &tmp, 2); dma_memcpy(location16, &tmp, 2);
...@@ -253,8 +247,6 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab, ...@@ -253,8 +247,6 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab,
*location16 = tmp; *location16 = tmp;
break; break;
case R_BFIN_HUIMM16: case R_BFIN_HUIMM16:
pr_debug("before %x after %x\n", *location16,
((value >> 16) & 0xffff));
tmp = ((value >> 16) & 0xffff); tmp = ((value >> 16) & 0xffff);
if ((unsigned long)location16 >= L1_CODE_START) { if ((unsigned long)location16 >= L1_CODE_START) {
dma_memcpy(location16, &tmp, 2); dma_memcpy(location16, &tmp, 2);
...@@ -265,7 +257,6 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab, ...@@ -265,7 +257,6 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab,
*location16 = (value & 0xffff); *location16 = (value & 0xffff);
break; break;
case R_BFIN_BYTE4_DATA: case R_BFIN_BYTE4_DATA:
pr_debug("before %x after %x\n", *location32, value);
*location32 = value; *location32 = value;
break; break;
case R_BFIN_PCREL24: case R_BFIN_PCREL24:
...@@ -273,12 +264,12 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab, ...@@ -273,12 +264,12 @@ apply_relocate_add(Elf_Shdr * sechdrs, const char *strtab,
case R_BFIN_PCREL12_JUMP: case R_BFIN_PCREL12_JUMP:
case R_BFIN_PCREL12_JUMP_S: case R_BFIN_PCREL12_JUMP_S:
case R_BFIN_PCREL10: case R_BFIN_PCREL10:
printk(KERN_ERR "module %s: Unsupported relocation: %u (no -mlong-calls?)\n" pr_err("unsupported relocation: %u (no -mlong-calls?)\n",
mod->name, ELF32_R_TYPE(rel[i].r_info)); mod->name, ELF32_R_TYPE(rel[i].r_info));
return -ENOEXEC; return -ENOEXEC;
default: default:
printk(KERN_ERR "module %s: Unknown relocation: %u\n", pr_err("unknown relocation: %u\n", mod->name,
mod->name, ELF32_R_TYPE(rel[i].r_info)); ELF32_R_TYPE(rel[i].r_info));
return -ENOEXEC; return -ENOEXEC;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment