git: 8291858235d3 - stable/14 - LinuxKPI: Implement dev_dbg_once() macro

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Sat, 17 Feb 2024 21:32:50 UTC
The branch stable/14 has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=8291858235d3e74fb02ebcdc2aa7f4d4cad2b6be

commit 8291858235d3e74fb02ebcdc2aa7f4d4cad2b6be
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2023-12-24 08:19:58 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2024-02-17 20:58:36 +0000

    LinuxKPI: Implement dev_dbg_once() macro
    
    Sponsored by:   Serenity Cyber Security, LLC
    Reviewed by:    manu, bz
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D42795
    
    (cherry picked from commit a01259965319897b836019f1d4dcf1b5a5a6ea1a)
---
 sys/compat/linuxkpi/common/include/linux/device.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h
index df06b356e092..2135d365460b 100644
--- a/sys/compat/linuxkpi/common/include/linux/device.h
+++ b/sys/compat/linuxkpi/common/include/linux/device.h
@@ -235,6 +235,14 @@ show_class_attr_string(struct class *class,
 	}					\
 } while (0)
 
+#define	dev_dbg_once(dev, ...) do {		\
+	static bool __dev_dbg_once;		\
+	if (!__dev_dbg_once) {			\
+		__dev_dbg_once = 1;		\
+		dev_dbg(dev, __VA_ARGS__);	\
+	}					\
+} while (0)
+
 #define	dev_err_ratelimited(dev, ...) do {	\
 	static linux_ratelimit_t __ratelimited;	\
 	if (linux_ratelimited(&__ratelimited))	\