git: bbff0400c1d7 - main - linuxkpi: Define `dev_dbg_ratelimited()`

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Wed, 25 Jan 2023 22:15:03 UTC
The branch main has been updated by dumbbell (ports committer):

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

commit bbff0400c1d7728ae1759d8f740033a0a2f8aeff
Author:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2023-01-19 00:15:03 +0000
Commit:     Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2023-01-25 21:48:32 +0000

    linuxkpi: Define `dev_dbg_ratelimited()`
    
    Reviewed by:    manu
    Approved by:    manu
    Differential Revision:  https://reviews.freebsd.org/D38145
---
 sys/compat/linuxkpi/common/include/linux/device.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h
index dfe80e84cea8..92e7e6772fbd 100644
--- a/sys/compat/linuxkpi/common/include/linux/device.h
+++ b/sys/compat/linuxkpi/common/include/linux/device.h
@@ -235,6 +235,12 @@ show_class_attr_string(struct class *class,
 		dev_warn(dev, __VA_ARGS__);	\
 } while (0)
 
+#define	dev_dbg_ratelimited(dev, ...) do {	\
+	static linux_ratelimit_t __ratelimited;	\
+	if (linux_ratelimited(&__ratelimited))	\
+		dev_dbg(dev, __VA_ARGS__);	\
+} while (0)
+
 /* Public and LinuxKPI internal devres functions. */
 void *lkpi_devres_alloc(void(*release)(struct device *, void *), size_t, gfp_t);
 void lkpi_devres_add(struct device *, void *);