linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] printk: Declare log_wait as external variable
@ 2020-02-03 13:15 Andy Shevchenko
  2020-02-04  2:16 ` Sergey Senozhatsky
  2020-02-11 12:43 ` Petr Mladek
  0 siblings, 2 replies; 10+ messages in thread
From: Andy Shevchenko @ 2020-02-03 13:15 UTC (permalink / raw)
  To: Petr Mladek, Sergey Senozhatsky, linux-kernel, Steven Rostedt
  Cc: Andy Shevchenko

Static analyzer is not happy:

kernel/printk/printk.c:421:1: warning: symbol 'log_wait' was not declared. Should it be static?

This is due to usage of log_wait in the other module without announcing
its declaration to the world. I wasn't able to dug into deep history of
reasons why it is so, and thus decide to make less invasive change, i.e.
declaring log_wait as external variable to make static analyzer happy.

Note the above is done if and only if the CONFIG_PROC_FS is enabled,
otherwise we fallback to static variable.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 kernel/printk/printk.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 633f41a11d75..43b5cb88c607 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -418,7 +418,14 @@ DEFINE_RAW_SPINLOCK(logbuf_lock);
 	} while (0)
 
 #ifdef CONFIG_PRINTK
+
+#ifdef CONFIG_PROC_FS
+extern wait_queue_head_t log_wait;	/* Used in fs/proc/kmsg.c */
 DECLARE_WAIT_QUEUE_HEAD(log_wait);
+#else
+static DECLARE_WAIT_QUEUE_HEAD(log_wait);
+#endif /* CONFIG_PROC_FS */
+
 /* the next printk record to read by syslog(READ) or /proc/kmsg */
 static u64 syslog_seq;
 static u32 syslog_idx;
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-02-13 12:02 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-03 13:15 [PATCH v1] printk: Declare log_wait as external variable Andy Shevchenko
2020-02-04  2:16 ` Sergey Senozhatsky
2020-02-04  9:05   ` Andy Shevchenko
2020-02-04 11:22     ` Sergey Senozhatsky
2020-02-04 11:31       ` Andy Shevchenko
2020-02-11 12:43 ` Petr Mladek
2020-02-12  1:31   ` Sergey Senozhatsky
2020-02-12 14:03     ` Petr Mladek
2020-02-12 14:24       ` John Ogness
2020-02-13 12:02         ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).