compat: backport printk_once
authorHauke Mehrtens <hauke@hauke-m.de>
Sat, 11 Sep 2010 16:19:59 +0000 (09:19 -0700)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Mon, 13 Sep 2010 17:59:03 +0000 (10:59 -0700)
This is needed by brcm80211.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
include/linux/compat-2.6.30.h

index eface8c..28f3d54 100644 (file)
@@ -30,6 +30,18 @@ static inline void dev_set_uevent_suppress(struct device *dev, int val)
        dev->uevent_suppress = val;
 }
 
+/*
+ * Print a one-time message (analogous to WARN_ONCE() et al):
+ */
+#define printk_once(x...) ({                   \
+       static bool __print_once;               \
+                                               \
+       if (!__print_once) {                    \
+               __print_once = true;            \
+               printk(x);                      \
+       }                                       \
+})
+
 #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)) */
 
 #endif /* LINUX_26_30_COMPAT_H */