kmsg_dump: fix build for CONFIG_PRINTK=n

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed Dec 2 03:59:01 EST 2009


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=595dd3d8bf953254d8d2f30f99c54fe09c470040
Commit:     595dd3d8bf953254d8d2f30f99c54fe09c470040
Parent:     75352662c54421b48ed58200565395b123952748
Author:     Randy Dunlap <randy.dunlap at oracle.com>
AuthorDate: Tue Dec 1 10:52:02 2009 -0800
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Wed Dec 2 08:44:33 2009 +0000

    kmsg_dump: fix build for CONFIG_PRINTK=n
    
    kmsg_dump() fails to build when CONFIG_PRINTK=n; provide stubs
    for the kmsg_dump*() functions when CONFIG_PRINTK=n.
    
    kernel/printk.c: In function 'kmsg_dump':
    kernel/printk.c:1501: error: 'log_buf_len' undeclared (first use in this function)
    kernel/printk.c:1502: error: 'logged_chars' undeclared (first use in this function)
    kernel/printk.c:1506: error: 'log_buf' undeclared (first use in this function)
    
    Signed-off-by: Randy Dunlap <randy.dunlap at oracle.com>
    Acked-by: Simon Kagstrom <simon.kagstrom at netinsight.net>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 include/linux/kmsg_dump.h |   16 ++++++++++++++++
 kernel/printk.c           |    2 +-
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/include/linux/kmsg_dump.h b/include/linux/kmsg_dump.h
index 7f089ec..e32aa26 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 051d1f5..2a56457 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



More information about the linux-mtd-cvs mailing list