Skip to content

Commit

Permalink
bug.h: Fix build with CONFIG_PRINTK disabled.
Browse files Browse the repository at this point in the history
Based upon an email by Joe Perches.

Reported-by: Randy Dunlap <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Acked-by: Randy Dunlap <[email protected]>
  • Loading branch information
davem330 committed May 24, 2011
1 parent 1f37070 commit 6b36783
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions include/asm-generic/bug.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ 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))

Expand All @@ -181,6 +183,25 @@ extern void warn_slowpath_null(const char *file, const int line);
__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

0 comments on commit 6b36783

Please sign in to comment.