summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2022-06-22 22:05:39 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2022-06-22 22:05:39 -0400
commit23dc00de78fbfea39b61aae2d261b621fee7853d (patch)
tree047ca618c7a40ad61fe71470a889d2871a0b0c4a /include/linux
parentff2ebf3f75814bc45353013782ebeb1556adfc05 (diff)
Fix printk_ratelimited()
printk_ratelimited was behind an #ifdef CONFIG_PRINTK, which we don't define, so it was a complete noop - oops. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/jiffies.h2
-rw-r--r--include/linux/printk.h6
-rw-r--r--include/linux/spinlock.h5
3 files changed, 8 insertions, 5 deletions
diff --git a/include/linux/jiffies.h b/include/linux/jiffies.h
index fe928265..c3f3e1f2 100644
--- a/include/linux/jiffies.h
+++ b/include/linux/jiffies.h
@@ -43,6 +43,8 @@
(time_after_eq64(a, b) && \
time_before_eq64(a, c))
+#define time_is_before_jiffies(a) time_after(jiffies, a)
+
#define HZ 1000
static inline u64 jiffies_to_nsecs(const unsigned long j)
diff --git a/include/linux/printk.h b/include/linux/printk.h
index bc1619f7..df9c1920 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -5,6 +5,7 @@
#define pr_fmt(fmt) fmt
#endif
+#include <linux/compiler.h>
#include <stdarg.h>
#include <stdio.h>
@@ -169,7 +170,6 @@ static inline int scnprintf(char * buf, size_t size, const char * fmt, ...)
* ratelimited messages with local ratelimit_state,
* no local ratelimit_state used in the !PRINTK case
*/
-#ifdef CONFIG_PRINTK
#define printk_ratelimited(fmt, ...) \
({ \
static DEFINE_RATELIMIT_STATE(_rs, \
@@ -179,10 +179,6 @@ static inline int scnprintf(char * buf, size_t size, const char * fmt, ...)
if (__ratelimit(&_rs)) \
printk(fmt, ##__VA_ARGS__); \
})
-#else
-#define printk_ratelimited(fmt, ...) \
- no_printk(fmt, ##__VA_ARGS__)
-#endif
#define pr_emerg_ratelimited(fmt, ...) \
printk_ratelimited(KERN_EMERG pr_fmt(fmt), ##__VA_ARGS__)
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index bd51188d..6c4a623c 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -15,6 +15,11 @@ static inline void raw_spin_lock_init(raw_spinlock_t *lock)
pthread_mutex_init(&lock->lock, NULL);
}
+static inline bool raw_spin_trylock(raw_spinlock_t *lock)
+{
+ return !pthread_mutex_trylock(&lock->lock);
+}
+
static inline void raw_spin_lock(raw_spinlock_t *lock)
{
pthread_mutex_lock(&lock->lock);