m68k/kernel: Modernize printing of kernel messages

- Use pr_err_ratelimited() instead of deprecated printk_ratelimit(),
  - Add dummies for validating format strings when debugging is
    disabled,
  - Convert from printk() to pr_*(),
  - Correct printf()-style format specifiers.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
This commit is contained in:
Geert Uytterhoeven 2016-12-06 19:57:37 +01:00
parent 4eee1e72ad
commit 7c79e1eef8
5 changed files with 26 additions and 37 deletions

View File

@ -110,8 +110,8 @@ static void m68k_dma_sync_single_for_device(struct device *dev,
cache_clear(handle, size);
break;
default:
if (printk_ratelimit())
printk("dma_sync_single_for_device: unsupported dir %u\n", dir);
pr_err_ratelimited("dma_sync_single_for_device: unsupported dir %u\n",
dir);
break;
}
}

View File

@ -12,9 +12,9 @@
#include <linux/kernel.h>
#if 0
#define DEBUGP printk
#define DEBUGP(fmt, ...) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#else
#define DEBUGP(fmt...)
#define DEBUGP(fmt, ...) no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
#endif
#ifdef CONFIG_MODULES
@ -51,8 +51,8 @@ int apply_relocate(Elf32_Shdr *sechdrs,
*location += sym->st_value - (uint32_t)location;
break;
default:
printk(KERN_ERR "module %s: Unknown relocation: %u\n",
me->name, ELF32_R_TYPE(rel[i].r_info));
pr_err("module %s: Unknown relocation: %u\n", me->name,
ELF32_R_TYPE(rel[i].r_info));
return -ENOEXEC;
}
}
@ -91,8 +91,8 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
*location = rel[i].r_addend + sym->st_value - (uint32_t)location;
break;
default:
printk(KERN_ERR "module %s: Unknown relocation: %u\n",
me->name, ELF32_R_TYPE(rel[i].r_info));
pr_err("module %s: Unknown relocation: %u\n", me->name,
ELF32_R_TYPE(rel[i].r_info));
return -ENOEXEC;
}
}

View File

@ -87,17 +87,17 @@ EXPORT_SYMBOL(pm_power_off);
void show_regs(struct pt_regs * regs)
{
printk("\n");
printk("Format %02x Vector: %04x PC: %08lx Status: %04x %s\n",
regs->format, regs->vector, regs->pc, regs->sr, print_tainted());
printk("ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n",
regs->orig_d0, regs->d0, regs->a2, regs->a1);
printk("A0: %08lx D5: %08lx D4: %08lx\n",
regs->a0, regs->d5, regs->d4);
printk("D3: %08lx D2: %08lx D1: %08lx\n",
regs->d3, regs->d2, regs->d1);
pr_info("Format %02x Vector: %04x PC: %08lx Status: %04x %s\n",
regs->format, regs->vector, regs->pc, regs->sr,
print_tainted());
pr_info("ORIG_D0: %08lx D0: %08lx A2: %08lx A1: %08lx\n",
regs->orig_d0, regs->d0, regs->a2, regs->a1);
pr_info("A0: %08lx D5: %08lx D4: %08lx\n", regs->a0, regs->d5,
regs->d4);
pr_info("D3: %08lx D2: %08lx D1: %08lx\n", regs->d3, regs->d2,
regs->d1);
if (!(regs->sr & PS_S))
printk("USP: %08lx\n", rdusp());
pr_info("USP: %08lx\n", rdusp());
}
void flush_thread(void)

View File

@ -598,9 +598,7 @@ static int mangle_kernel_stack(struct pt_regs *regs, int formatvec,
/*
* user process trying to return with weird frame format
*/
#ifdef DEBUG
printk("user process returning with weird frame format\n");
#endif
pr_debug("user process returning with weird frame format\n");
return 1;
}
if (!fsize) {
@ -846,10 +844,8 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set,
int err = 0, sig = ksig->sig;
if (fsize < 0) {
#ifdef DEBUG
printk ("setup_frame: Unknown frame format %#x\n",
regs->format);
#endif
pr_debug("setup_frame: Unknown frame format %#x\n",
regs->format);
return -EFAULT;
}
@ -905,9 +901,7 @@ static int setup_frame(struct ksignal *ksig, sigset_t *set,
if (regs->stkadj) {
struct pt_regs *tregs =
(struct pt_regs *)((ulong)regs + regs->stkadj);
#ifdef DEBUG
printk("Performing stackadjust=%04x\n", regs->stkadj);
#endif
pr_debug("Performing stackadjust=%04lx\n", regs->stkadj);
/* This must be copied with decreasing addresses to
handle overlaps. */
tregs->vector = 0;
@ -926,10 +920,8 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
int err = 0, sig = ksig->sig;
if (fsize < 0) {
#ifdef DEBUG
printk ("setup_frame: Unknown frame format %#x\n",
regs->format);
#endif
pr_debug("setup_frame: Unknown frame format %#x\n",
regs->format);
return -EFAULT;
}
@ -993,9 +985,7 @@ static int setup_rt_frame(struct ksignal *ksig, sigset_t *set,
if (regs->stkadj) {
struct pt_regs *tregs =
(struct pt_regs *)((ulong)regs + regs->stkadj);
#ifdef DEBUG
printk("Performing stackadjust=%04x\n", regs->stkadj);
#endif
pr_debug("Performing stackadjust=%04lx\n", regs->stkadj);
/* This must be copied with decreasing addresses to
handle overlaps. */
tregs->vector = 0;

View File

@ -83,8 +83,7 @@ static void __init parse_uboot_commandline(char *commandp, int size)
initrd_start = uboot_initrd_start;
initrd_end = uboot_initrd_end;
ROOT_DEV = Root_RAM0;
printk(KERN_INFO "initrd at 0x%lx:0x%lx\n",
initrd_start, initrd_end);
pr_info("initrd at 0x%lx:0x%lx\n", initrd_start, initrd_end);
}
#endif /* if defined(CONFIG_BLK_DEV_INITRD) */
}