aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/kernel.h3
-rw-r--r--include/linux/ratelimit.h3
-rw-r--r--kernel/printk.c6
-rw-r--r--lib/ratelimit.c6
4 files changed, 10 insertions, 8 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 3305f33201be..21d0d822c716 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -240,7 +240,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)
240asmlinkage int printk(const char * fmt, ...) 240asmlinkage int printk(const char * fmt, ...)
241 __attribute__ ((format (printf, 1, 2))) __cold; 241 __attribute__ ((format (printf, 1, 2))) __cold;
242 242
243extern int printk_ratelimit(void); 243extern int __printk_ratelimit(const char *func);
244#define printk_ratelimit() __printk_ratelimit(__func__)
244extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, 245extern bool printk_timed_ratelimit(unsigned long *caller_jiffies,
245 unsigned int interval_msec); 246 unsigned int interval_msec);
246 247
diff --git a/include/linux/ratelimit.h b/include/linux/ratelimit.h
index 187bc16c1f15..668cf1bef030 100644
--- a/include/linux/ratelimit.h
+++ b/include/linux/ratelimit.h
@@ -25,6 +25,7 @@ struct ratelimit_state {
25 .burst = burst_init, \ 25 .burst = burst_init, \
26 } 26 }
27 27
28extern int __ratelimit(struct ratelimit_state *rs); 28extern int ___ratelimit(struct ratelimit_state *rs, const char *func);
29#define __ratelimit(state) ___ratelimit(state, __func__)
29 30
30#endif /* _LINUX_RATELIMIT_H */ 31#endif /* _LINUX_RATELIMIT_H */
diff --git a/kernel/printk.c b/kernel/printk.c
index b997c893cdcf..8283dbe15af4 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1364,11 +1364,11 @@ late_initcall(disable_boot_consoles);
1364 */ 1364 */
1365DEFINE_RATELIMIT_STATE(printk_ratelimit_state, 5 * HZ, 10); 1365DEFINE_RATELIMIT_STATE(printk_ratelimit_state, 5 * HZ, 10);
1366 1366
1367int printk_ratelimit(void) 1367int __printk_ratelimit(const char *func)
1368{ 1368{
1369 return __ratelimit(&printk_ratelimit_state); 1369 return ___ratelimit(&printk_ratelimit_state, func);
1370} 1370}
1371EXPORT_SYMBOL(printk_ratelimit); 1371EXPORT_SYMBOL(__printk_ratelimit);
1372 1372
1373/** 1373/**
1374 * printk_timed_ratelimit - caller-controlled printk ratelimiting 1374 * printk_timed_ratelimit - caller-controlled printk ratelimiting
diff --git a/lib/ratelimit.c b/lib/ratelimit.c
index 5551731ae1d4..09f5ce1810dc 100644
--- a/lib/ratelimit.c
+++ b/lib/ratelimit.c
@@ -20,7 +20,7 @@
20 * This enforces a rate limit: not more than @rs->ratelimit_burst callbacks 20 * This enforces a rate limit: not more than @rs->ratelimit_burst callbacks
21 * in every @rs->ratelimit_jiffies 21 * in every @rs->ratelimit_jiffies
22 */ 22 */
23int __ratelimit(struct ratelimit_state *rs) 23int ___ratelimit(struct ratelimit_state *rs, const char *func)
24{ 24{
25 unsigned long flags; 25 unsigned long flags;
26 int ret; 26 int ret;
@@ -43,7 +43,7 @@ int __ratelimit(struct ratelimit_state *rs)
43 if (time_is_before_jiffies(rs->begin + rs->interval)) { 43 if (time_is_before_jiffies(rs->begin + rs->interval)) {
44 if (rs->missed) 44 if (rs->missed)
45 printk(KERN_WARNING "%s: %d callbacks suppressed\n", 45 printk(KERN_WARNING "%s: %d callbacks suppressed\n",
46 __func__, rs->missed); 46 func, rs->missed);
47 rs->begin = 0; 47 rs->begin = 0;
48 rs->printed = 0; 48 rs->printed = 0;
49 rs->missed = 0; 49 rs->missed = 0;
@@ -59,4 +59,4 @@ int __ratelimit(struct ratelimit_state *rs)
59 59
60 return ret; 60 return ret;
61} 61}
62EXPORT_SYMBOL(__ratelimit); 62EXPORT_SYMBOL(___ratelimit);