lkml.org 
[lkml]   [2008]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] [2/3] add WARN_ON_SECS macro
Add WARN_ON_SECS macro for some serious case which need repeat the
warnings, but with some ratelimit.

Signed-off-by: Dave Young <hidave.darkstar@gmail.com>

---
include/asm-generic/bug.h | 8 ++++++++
1 file changed, 8 insertions(+)

diff -upr linux/include/asm-generic/bug.h linux.new/include/asm-generic/bug.h
--- linux/include/asm-generic/bug.h 2008-03-10 13:27:03.000000000 +0800
+++ linux.new/include/asm-generic/bug.h 2008-03-10 13:27:14.000000000 +0800
@@ -3,6 +3,7 @@

#include <linux/compiler.h>

+
#ifdef CONFIG_BUG

#ifdef CONFIG_GENERIC_BUG
@@ -75,6 +76,13 @@ extern void warn_on_slowpath(const char
unlikely(__ret_warn_once); \
})

+#define WARN_ON_SECS(condition, secs) ({ \
+ int __ret_warn_on = !!(condition); \
+ if (unlikely(__ret_warn_on)) \
+ if (__ratelimit(secs * HZ, 1)) \
+ WARN_ON(condition); \
+})
+
#ifdef CONFIG_SMP
# define WARN_ON_SMP(x) WARN_ON(x)
#else

\
 
 \ /
  Last update: 2008-03-10 07:31    [W:0.034 / U:4.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site