From 8291858235d3e74fb02ebcdc2aa7f4d4cad2b6be Mon Sep 17 00:00:00 2001 From: Vladimir Kondratyev Date: Sun, 24 Dec 2023 11:19:58 +0300 Subject: [PATCH] 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 df06b356e09..2135d365460 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)) \