Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252271
b: refs/heads/master
c: 86e4ca6
h: refs/heads/master
i:
  252269: 40d9ffc
  252267: 9bf2f50
  252263: c3ef79f
  252255: 6b907d3
v: v3
  • Loading branch information
David S. Miller committed May 26, 2011
1 parent 1b5c363 commit f4fa1bc
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 41 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 90e62474fd08e16ba5309886c801243b0eb782f3
refs/heads/master: 86e4ca66e81bba0f8640f1fa19b8b8f72cbd0561
40 changes: 0 additions & 40 deletions trunk/include/asm-generic/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,46 +162,6 @@ extern void warn_slowpath_null(const char *file, const int line);
unlikely(__ret_warn_once); \
})

#ifdef CONFIG_PRINTK

#define WARN_ON_RATELIMIT(condition, state) \
WARN_ON((condition) && __ratelimit(state))

#define __WARN_RATELIMIT(condition, state, format...) \
({ \
int rtn = 0; \
if (unlikely(__ratelimit(state))) \
rtn = WARN(condition, format); \
rtn; \
})

#define WARN_RATELIMIT(condition, format...) \
({ \
static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \
__WARN_RATELIMIT(condition, &_rs, format); \
})

#else

#define WARN_ON_RATELIMIT(condition, state) \
WARN_ON(condition)

#define __WARN_RATELIMIT(condition, state, format...) \
({ \
int rtn = WARN(condition, format); \
rtn; \
})

#define WARN_RATELIMIT(condition, format...) \
({ \
int rtn = WARN(condition, format); \
rtn; \
})

#endif

/*
* WARN_ON_SMP() is for cases that the warning is either
* meaningless for !SMP or may even cause failures.
Expand Down
40 changes: 40 additions & 0 deletions trunk/include/linux/ratelimit.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,44 @@ extern struct ratelimit_state printk_ratelimit_state;
extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
#define __ratelimit(state) ___ratelimit(state, __func__)

#ifdef CONFIG_PRINTK

#define WARN_ON_RATELIMIT(condition, state) \
WARN_ON((condition) && __ratelimit(state))

#define __WARN_RATELIMIT(condition, state, format...) \
({ \
int rtn = 0; \
if (unlikely(__ratelimit(state))) \
rtn = WARN(condition, format); \
rtn; \
})

#define WARN_RATELIMIT(condition, format...) \
({ \
static DEFINE_RATELIMIT_STATE(_rs, \
DEFAULT_RATELIMIT_INTERVAL, \
DEFAULT_RATELIMIT_BURST); \
__WARN_RATELIMIT(condition, &_rs, format); \
})

#else

#define WARN_ON_RATELIMIT(condition, state) \
WARN_ON(condition)

#define __WARN_RATELIMIT(condition, state, format...) \
({ \
int rtn = WARN(condition, format); \
rtn; \
})

#define WARN_RATELIMIT(condition, format...) \
({ \
int rtn = WARN(condition, format); \
rtn; \
})

#endif

#endif /* _LINUX_RATELIMIT_H */
1 change: 1 addition & 0 deletions trunk/net/core/filter.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <asm/unaligned.h>
#include <linux/filter.h>
#include <linux/reciprocal_div.h>
#include <linux/ratelimit.h>

/* No hurry in this branch */
static void *__load_pointer(const struct sk_buff *skb, int k, unsigned int size)
Expand Down

0 comments on commit f4fa1bc

Please sign in to comment.