mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wenchao Hao <haowenchao22@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>,
	Waiman Long <longman@redhat.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	linux-kernel@vger.kernel.org
Cc: Wenchao Hao <haowenchao22@gmail.com>
Subject: [PATCH] lockdep: make class_filter() inline and remove unnecessary macros
Date: Thu,  6 Jun 2024 16:57:44 +0800	[thread overview]
Message-ID: <20240606085744.3475629-1-haowenchao22@gmail.com> (raw)

This is just a clean code which simplify the code implement and make it
easy to understand. No logic changed from origin implement.

Make class_filter() inline which just return 0, and directly called from
verbose(), very_verbose(), HARDIRQ_verbose() and SOFTIRQ_verbose() without
macro control, remove unnecessary macros VERY_VERBOSE, HARDIRQ_VERBOSE
and SOFTIRQ_VERBOSE.

Signed-off-by: Wenchao Hao <haowenchao22@gmail.com>
---
 kernel/locking/lockdep.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 151bd3de5936..cd8356106da2 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -478,21 +478,11 @@ void lockdep_set_selftest_task(struct task_struct *task)
  */
 
 #define VERBOSE			0
-#define VERY_VERBOSE		0
 
-#if VERBOSE
-# define HARDIRQ_VERBOSE	1
-# define SOFTIRQ_VERBOSE	1
-#else
-# define HARDIRQ_VERBOSE	0
-# define SOFTIRQ_VERBOSE	0
-#endif
-
-#if VERBOSE || HARDIRQ_VERBOSE || SOFTIRQ_VERBOSE
 /*
  * Quick filtering for interesting events:
  */
-static int class_filter(struct lock_class *class)
+static inline int class_filter(struct lock_class *class)
 {
 #if 0
 	/* Example */
@@ -506,14 +496,10 @@ static int class_filter(struct lock_class *class)
 	/* Filter everything else. 1 would be to allow everything else */
 	return 0;
 }
-#endif
 
 static int verbose(struct lock_class *class)
 {
-#if VERBOSE
 	return class_filter(class);
-#endif
-	return 0;
 }
 
 static void print_lockdep_off(const char *bug_msg)
@@ -809,10 +795,7 @@ static void print_kernel_ident(void)
 
 static int very_verbose(struct lock_class *class)
 {
-#if VERY_VERBOSE
 	return class_filter(class);
-#endif
-	return 0;
 }
 
 /*
@@ -4171,18 +4154,12 @@ void print_irqtrace_events(struct task_struct *curr)
 
 static int HARDIRQ_verbose(struct lock_class *class)
 {
-#if HARDIRQ_VERBOSE
 	return class_filter(class);
-#endif
-	return 0;
 }
 
 static int SOFTIRQ_verbose(struct lock_class *class)
 {
-#if SOFTIRQ_VERBOSE
 	return class_filter(class);
-#endif
-	return 0;
 }
 
 static int (*state_verbose_f[])(struct lock_class *class) = {
-- 
2.38.1


             reply	other threads:[~2024-06-06  8:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-06  8:57 Wenchao Hao [this message]
2024-08-05 17:39 ` Boqun Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240606085744.3475629-1-haowenchao22@gmail.com \
    --to=haowenchao22@gmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®