git: c4163160e44d - main - linuxkpi: Add `dev_warn_once()` in <linux/device.h>

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Fri, 11 Nov 2022 17:57:50 UTC
The branch main has been updated by dumbbell (ports committer):

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

commit c4163160e44d1f329301b0fe943854b9dc0750dc
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2022-11-11 17:42:31 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2022-11-11 17:42:31 +0000

    linuxkpi: Add `dev_warn_once()` in <linux/device.h>
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D36968
---
 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 f3e2c4697562..720a2019c0f0 100644
--- a/sys/compat/linuxkpi/common/include/linux/device.h
+++ b/sys/compat/linuxkpi/common/include/linux/device.h
@@ -206,6 +206,14 @@ show_class_attr_string(struct class *class,
 	}					\
 } while (0)
 
+#define	dev_warn_once(dev, ...) do {		\
+	static bool __dev_warn_once;		\
+	if (!__dev_warn_once) {			\
+		__dev_warn_once = 1;		\
+		dev_warn(dev, __VA_ARGS__);	\
+	}					\
+} while (0)
+
 #define	dev_err_once(dev, ...) do {		\
 	static bool __dev_err_once;		\
 	if (!__dev_err_once) {			\