mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Print an error if rwlock.h is included directly.
@ 2022-08-16  7:51 Sebastian Andrzej Siewior
  2022-08-25 16:09 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-08-16  7:51 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn,
	Thomas Gleixner, Sebastian Andrzej Siewior

rwlock.h shouldn't be included directly in source code. PREEMPT_RT uses
a different implementation and this rwlock.h include breaks it.

Add an error message if linux/rwlock.h is included.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 79e759aac543b..d130db6726414 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -5749,6 +5749,12 @@ sub process {
 			}
 		}
 
+# rwlock.h must not be included directly. It will be included via spinlock.h if needed.
+		if ($rawline =~ /\#\s*include.*\<linux\/rwlock\.h/) {
+			ERROR("INCLUDES_BAD_HEADER",
+				"Please don't include rwlock.h directly, use spinlock.h if needed.\n" . $herecurr);
+		}
+
 # warn if <asm/foo.h> is #included and <linux/foo.h> is available and includes
 # itself <asm/foo.h> (uses RAW line)
 		if ($tree && $rawline =~ m{^.\s*\#\s*include\s*\<asm\/(.*)\.h\>}) {
-- 
2.37.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] checkpatch: Print an error if rwlock.h is included directly.
  2022-08-16  7:51 [PATCH] checkpatch: Print an error if rwlock.h is included directly Sebastian Andrzej Siewior
@ 2022-08-25 16:09 ` Sebastian Andrzej Siewior
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Andrzej Siewior @ 2022-08-25 16:09 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andy Whitcroft, Joe Perches, Dwaipayan Ray, Lukas Bulwahn,
	Thomas Gleixner

On 2022-08-16 09:51:18 [+0200], To linux-kernel@vger.kernel.org wrote:
> rwlock.h shouldn't be included directly in source code. PREEMPT_RT uses
> a different implementation and this rwlock.h include breaks it.
> 
> Add an error message if linux/rwlock.h is included.

This can be ignored, I found a more efficient way of doing this.

> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Sebastian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-08-25 16:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-16  7:51 [PATCH] checkpatch: Print an error if rwlock.h is included directly Sebastian Andrzej Siewior
2022-08-25 16:09 ` Sebastian Andrzej Siewior

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®