Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Jun 2026 06:34:32 +0000
From:      Bjoern A. Zeeb <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 2b3a18dadf03 - stable/15 - LinuxKPI: add KERNEL_VERSION() macro
Message-ID:  <6a4211f8.47784.7d4fb8a8@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=2b3a18dadf03c6235b5b3e798176a8cb452792b4

commit 2b3a18dadf03c6235b5b3e798176a8cb452792b4
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-06-13 11:08:00 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-06-29 03:53:57 +0000

    LinuxKPI: add KERNEL_VERSION() macro
    
    Add a KERNEL_VERSION() macro which normally would be in linux/version.h.
    On Linux that file is auto-generated and we are supporting more than
    one Linux version in LinuxKPI anyway so any further defines in there
    would likely be wrong.
    
    Adding the macro helps to support (vendor/out of tree) drivers more
    easily which are supporting multiple Linux versions.
    
    Reviewed by:    dumbbell
    Differential Revision: https://reviews.freebsd.org/D57590
    
    (cherry picked from commit c5d6e2085a471cbb75cc7b88b37a2fe6276c16f8)
---
 sys/compat/linuxkpi/common/include/linux/kernel.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/kernel.h b/sys/compat/linuxkpi/common/include/linux/kernel.h
index afbd9208a410..3fcc6c1a925e 100644
--- a/sys/compat/linuxkpi/common/include/linux/kernel.h
+++ b/sys/compat/linuxkpi/common/include/linux/kernel.h
@@ -67,6 +67,9 @@
 
 #include <linux/stdarg.h>
 
+#define	KERNEL_VERSION(a,b,c)						\
+    (((a) << 16) + ((b) << 8) + ((c) > 255 ? 255 : (c)))
+
 #define KERN_CONT       ""
 #define	KERN_EMERG	"<0>"
 #define	KERN_ALERT	"<1>"


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a4211f8.47784.7d4fb8a8>