git: c4b72d285c7a - stable/13 - linuxkpi: Add `dev_warn_once()` in <linux/device.h>

From: Emmanuel Vadot <manu_at_FreeBSD.org>
Date: Tue, 24 Jan 2023 08:54:04 UTC
The branch stable/13 has been updated by manu:

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

commit c4b72d285c7a5b09e5f733b129df01e76f08be84
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2022-11-11 17:42:31 +0000
Commit:     Emmanuel Vadot <manu@FreeBSD.org>
CommitDate: 2023-01-24 09:08:00 +0000

    linuxkpi: Add `dev_warn_once()` in <linux/device.h>
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D36968
    
    (cherry picked from commit c4163160e44d1f329301b0fe943854b9dc0750dc)
---
 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 6c76836c4d94..70015fb7d81f 100644
--- a/sys/compat/linuxkpi/common/include/linux/device.h
+++ b/sys/compat/linuxkpi/common/include/linux/device.h
@@ -204,6 +204,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) {			\