diff mbox series

mm: use __func__ replace function name

Message ID 1592220534-4656-1-git-send-email-yanghui.def@gmail.com (mailing list archive)
State New, archived
Headers show
Series mm: use __func__ replace function name | expand

Commit Message

hui yang June 15, 2020, 11:28 a.m. UTC
From: YangHui <yanghui.def@gmail.com>

it's much better to use __func__

Signed-off-by: YangHui <yanghui.def@gmail.com>
---
 mm/slab_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Matthew Wilcox June 15, 2020, 11:47 a.m. UTC | #1
On Mon, Jun 15, 2020 at 07:28:54PM +0800, hui yang wrote:
> From: YangHui <yanghui.def@gmail.com>
> 
> it's much better to use __func__

Not always.  This message is reporting the improper usage of a public API.
If we were to, for example, split the function into two and rename this
half of it __kmem_cache_destroy(), we'd still want this message to say
kmem_cache_destroy.

I don't think we should apply this change, and if you have similar patches
in mind, I'd like to see a more detailed argument than "it's better".

> @@ -960,8 +960,8 @@ void kmem_cache_destroy(struct kmem_cache *s)
>  		err = shutdown_cache(s);
>  
>  	if (err) {
> -		pr_err("kmem_cache_destroy %s: Slab cache still has objects\n",
> -		       s->name);
> +		pr_err("%s: %s: Slab cache still has objects\n",
> +		       __func__, s->name);
>  		dump_stack();
>  	}
>  out_unlock:
diff mbox series

Patch

diff --git a/mm/slab_common.c b/mm/slab_common.c
index 9e72ba2..274b374 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -960,8 +960,8 @@  void kmem_cache_destroy(struct kmem_cache *s)
 		err = shutdown_cache(s);
 
 	if (err) {
-		pr_err("kmem_cache_destroy %s: Slab cache still has objects\n",
-		       s->name);
+		pr_err("%s: %s: Slab cache still has objects\n",
+		       __func__, s->name);
 		dump_stack();
 	}
 out_unlock: