All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Xie Yongji <xieyongji@bytedance.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH] vduse:  Remove include of rwlock.h
Date: Tue, 16 Aug 2022 04:39:29 -0400	[thread overview]
Message-ID: <20220816043636-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <YvtWdVtH4Y0MuG7k@linutronix.de>

On Tue, Aug 16, 2022 at 10:33:57AM +0200, Sebastian Andrzej Siewior wrote:
> On 2022-08-16 04:26:59 [-0400], Michael S. Tsirkin wrote:
> > #ifndef __LINUX_SPINLOCK_H
> > # error "please don't include this file directly"
> > #endif
> > 
> > I wonder how does it build.
> 
> spinlock.h is included earlier by other means so this define is
> satisfied.
> 
> Sebastian

I see. In that case this ifndef is pointless isn't it?
We want something like:

>>>

rwlock: detect use outside of spinlock.h

current ifndef does not really prevent including rwlock.h
directly.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>


diff --git a/include/linux/rwlock.h b/include/linux/rwlock.h
index 8f416c5e929e..c0ef596f340b 100644
--- a/include/linux/rwlock.h
+++ b/include/linux/rwlock.h
@@ -1,7 +1,7 @@
 #ifndef __LINUX_RWLOCK_H
 #define __LINUX_RWLOCK_H
 
-#ifndef __LINUX_SPINLOCK_H
+#ifndef __LINUX_INSIDE_SPINLOCK_H
 # error "please don't include this file directly"
 #endif
 
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 5c0c5174155d..3d456d71d235 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -2,6 +2,8 @@
 #ifndef __LINUX_SPINLOCK_H
 #define __LINUX_SPINLOCK_H
 
+#define __LINUX_INSIDE_SPINLOCK_H
+
 /*
  * include/linux/spinlock.h - generic spinlock/rwlock declarations
  *
@@ -492,4 +494,6 @@ int __alloc_bucket_spinlocks(spinlock_t **locks, unsigned int *lock_mask,
 
 void free_bucket_spinlocks(spinlock_t *locks);
 
+#undef __LINUX_INSIDE_SPINLOCK_H
+
 #endif /* __LINUX_SPINLOCK_H */

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2022-08-16  8:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16  7:48 [PATCH] vduse: Remove include of rwlock.h Sebastian Andrzej Siewior
2022-08-16  8:26 ` Michael S. Tsirkin
2022-08-16  8:33   ` Sebastian Andrzej Siewior
2022-08-16  8:39     ` Michael S. Tsirkin [this message]
2022-08-16 10:45       ` Sebastian Andrzej Siewior
2022-08-16 11:59         ` Michael S. Tsirkin

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=20220816043636-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=bigeasy@linutronix.de \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xieyongji@bytedance.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.