Commit 595dd3d8bf953254d8d2f30f99c54fe09c470040

Authored by Randy Dunlap
Committed by David Woodhouse
1 parent 75352662c5

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@oracle.com>
Acked-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Showing 2 changed files with 17 additions and 1 deletions Side-by-side Diff

include/linux/kmsg_dump.h
... ... @@ -35,11 +35,27 @@
35 35 int registered;
36 36 };
37 37  
  38 +#ifdef CONFIG_PRINTK
38 39 void kmsg_dump(enum kmsg_dump_reason reason);
39 40  
40 41 int kmsg_dump_register(struct kmsg_dumper *dumper);
41 42  
42 43 int kmsg_dump_unregister(struct kmsg_dumper *dumper);
  44 +#else
  45 +static inline void kmsg_dump(enum kmsg_dump_reason reason)
  46 +{
  47 +}
  48 +
  49 +static inline int kmsg_dump_register(struct kmsg_dumper *dumper)
  50 +{
  51 + return -EINVAL;
  52 +}
  53 +
  54 +static inline int kmsg_dump_unregister(struct kmsg_dumper *dumper)
  55 +{
  56 + return -EINVAL;
  57 +}
  58 +#endif
43 59  
44 60 #endif /* _LINUX_KMSG_DUMP_H */
... ... @@ -1405,7 +1405,6 @@
1405 1405 return false;
1406 1406 }
1407 1407 EXPORT_SYMBOL(printk_timed_ratelimit);
1408   -#endif
1409 1408  
1410 1409 static DEFINE_SPINLOCK(dump_list_lock);
1411 1410 static LIST_HEAD(dump_list);
... ... @@ -1524,4 +1523,5 @@
1524 1523 dumper->dump(dumper, reason, s1, l1, s2, l2);
1525 1524 spin_unlock_irqrestore(&dump_list_lock, flags);
1526 1525 }
  1526 +#endif