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@xxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxxxxx https://lists.linuxfoundation.org/mailman/listinfo/virtualization