summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/kmsg_dump.h16
-rw-r--r--kernel/printk.c2
2 files changed, 17 insertions, 1 deletions
diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index 7f089ec5ef32..e32aa268efac 100644
--- a/include/linux/kmsg_dump.h
+++ b/include/linux/kmsg_dump.h
@@ -35,10 +35,26 @@ struct kmsg_dumper {
int registered;
};
+#ifdef CONFIG_PRINTK
void kmsg_dump(enum kmsg_dump_reason reason);
int kmsg_dump_register(struct kmsg_dumper *dumper);
int kmsg_dump_unregister(struct kmsg_dumper *dumper);
+#else
+static inline void kmsg_dump(enum kmsg_dump_reason reason)
+{
+}
+
+static inline int kmsg_dump_register(struct kmsg_dumper *dumper)
+{
+ return -EINVAL;
+}
+
+static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper)
+{
+ return -EINVAL;
+}
+#endif
#endif /* _LINUX_KMSG_DUMP_H */
diff --git a/kernel/printk.c b/kernel/printk.c
index 051d1f50648f..2a564570f822 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1405,7 +1405,6 @@ bool printk_timed_ratelimit(unsigned long *caller_jiffies,
return false;
}
EXPORT_SYMBOL(printk_timed_ratelimit);
-#endif
static DEFINE_SPINLOCK(dump_list_lock);
static LIST_HEAD(dump_list);
@@ -1524,3 +1523,4 @@ void kmsg_dump(enum kmsg_dump_reason reason)
dumper->dump(dumper, reason, s1, l1, s2, l2);
spin_unlock_irqrestore(&dump_list_lock, flags);
}
+#endif