[PATCH] m68k/sun3: use __func__ to get funcion's name in an output message

XueBing Chen posted 1 patch 3 years, 10 months ago
arch/m68k/sun3/mmu_emu.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
[PATCH] m68k/sun3: use __func__ to get funcion's name in an output message
Posted by XueBing Chen 3 years, 10 months ago

Prefer using '"%s...", __func__' to get current function's name in
an output message.

Signed-off-by: XueBing Chen <chenxuebing@jari.cn>
---
 arch/m68k/sun3/mmu_emu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/m68k/sun3/mmu_emu.c b/arch/m68k/sun3/mmu_emu.c
index 7ec20817c0c9..51480f703dc8 100644
--- a/arch/m68k/sun3/mmu_emu.c
+++ b/arch/m68k/sun3/mmu_emu.c
@@ -211,7 +211,7 @@ void clear_context(unsigned long context)
 
      if(context) {
 	     if(!ctx_alloc[context])
-		     panic("clear_context: context not allocated\n");
+		     panic("%s: context not allocated\n", __func__);
 
 	     ctx_alloc[context]->context = SUN3_INVALID_CONTEXT;
 	     ctx_alloc[context] = (struct mm_struct *)0;
@@ -261,7 +261,7 @@ unsigned long get_free_context(struct mm_struct *mm)
 		}
 		// check to make sure one was really free...
 		if(new == CONTEXTS_NUM)
-			panic("get_free_context: failed to find free context");
+			panic("%s: failed to find free context", __func__);
 	}
 
 	ctx_alloc[new] = mm;
@@ -369,7 +369,7 @@ int mmu_emu_handle_fault (unsigned long vaddr, int read_flag, int kernel_fault)
 	}
 
 #ifdef DEBUG_MMU_EMU
-	pr_info("mmu_emu_handle_fault: vaddr=%lx type=%s crp=%p\n",
+	pr_info("%s: vaddr=%lx type=%s crp=%p\n", __func__,
 		vaddr, read_flag ? "read" : "write", crp);
 #endif
 
@@ -377,7 +377,7 @@ int mmu_emu_handle_fault (unsigned long vaddr, int read_flag, int kernel_fault)
 	offset  = (vaddr >> SUN3_PTE_SIZE_BITS) & 0xF;
 
 #ifdef DEBUG_MMU_EMU
-	pr_info("mmu_emu_handle_fault: segment=%lx offset=%lx\n", segment,
+	pr_info("%s: segment=%lx offset=%lx\n", __func__, segment,
 		offset);
 #endif
 
-- 
2.36.1



Re: [PATCH] m68k/sun3: use __func__ to get funcion's name in an output message
Posted by Geert Uytterhoeven 3 years, 9 months ago
On Fri, Jun 17, 2022 at 12:06 PM XueBing Chen <chenxuebing@jari.cn> wrote:
> Prefer using '"%s...", __func__' to get current function's name in
> an output message.
>
> Signed-off-by: XueBing Chen <chenxuebing@jari.cn>

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
i.e. will queue in the m68k for-v5.20 branch.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds