git: 1adbb3ff4471 - stable/15 - LinuxKPI: implement __UNIQUE_ID() macro

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Tue, 22 Sep 2026 15:48:54 UTC
The branch stable/15 has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=1adbb3ff4471bd7c1a5751ecddefb533b4465229

commit 1adbb3ff4471bd7c1a5751ecddefb533b4465229
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2026-09-17 07:42:12 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2026-09-22 15:47:03 +0000

    LinuxKPI: implement __UNIQUE_ID() macro
    
    Requred by drm-kmod v6.12.103
    
    Obtained from:  OpenBSD
    
    Reviewed by:    bz, emaste
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D59733
    
    (cherry picked from commit 8b05d84be9e288d201e8631750ae180b07311ba7)
---
 sys/compat/linuxkpi/common/include/linux/compiler.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/compiler.h b/sys/compat/linuxkpi/common/include/linux/compiler.h
index 4fcd1f9f342b..cf9494a45553 100644
--- a/sys/compat/linuxkpi/common/include/linux/compiler.h
+++ b/sys/compat/linuxkpi/common/include/linux/compiler.h
@@ -97,4 +97,8 @@
 #define	__struct_size(_s)	__builtin_object_size(_s, 0)
 #endif
 
+#define	____UNIQUE_ID(name, num)	__UNIQUE_ID_##name##_##num
+#define	___UNIQUE_ID(name, num)		____UNIQUE_ID(name, num)
+#define	__UNIQUE_ID(name)		___UNIQUE_ID(name, __COUNTER__)
+
 #endif	/* _LINUXKPI_LINUX_COMPILER_H_ */