History

printk: fix build warning when CONFIG_PRINTK=n

build warning when CONFIG_PRINTK=n kernel/printk/printk.c:175:5: warning: no previous prototype for 'devkmsg_sysctl_set_loglvl' [-Wmissing-prototypes] devkmsg_sysctl_set_loglvl() is only used in sysctl.c when CONFIG_PRINTK=y, but it participates in the build when CONFIG_PRINTK=n. So add compile dependency CONFIG_PRINTK=y && CONFIG_SYSCTL=y to fix the build warning.

Xiaoming Ni committed 4 years ago

Commit fdcd4071 parent d8c04183 files · +4 −5Browse files

Unified · Split

3 files
  1. include/linux/printk.h +0 −4
  2. kernel/printk/internal.h +2 −0
  3. kernel/printk/printk.c +2 −1
include/linux/printk.h+0−4
@@ -183,10 +183,6 @@ extern bool printk_timed_ratelimit(unsigned long *caller_jiffies, · 182 unmodified lines
183183 extern int printk_delay_msec;
184184 extern int dmesg_restrict;
185185
186−extern int
187−devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void *buf,
188− size_t *lenp, loff_t *ppos);
189−
190186 extern void wake_up_klogd(void);
191187
192188 char *log_buf_addr_get(void);
kernel/printk/internal.h+2−0
@@ -6,6 +6,8 @@ · 5 unmodified lines
66
77 #if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL)
88 void __init printk_sysctl_init(void);
9+int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
10+ void *buffer, size_t *lenp, loff_t *ppos);
911 #else
1012 #define printk_sysctl_init() do { } while (0)
1113 #endif
kernel/printk/printk.c+2−1
@@ -171,7 +171,7 @@ static int __init control_devkmsg(char *str) · 170 unmodified lines
171171 __setup("printk.devkmsg=", control_devkmsg);
172172
173173 char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit";
174−
174+#if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL)
175175 int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write,
176176 void *buffer, size_t *lenp, loff_t *ppos)
177177 {
@@ -210,6 +210,7 @@ int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, · 32 unmodified lines
210210
211211 return 0;
212212 }
213+#endif /* CONFIG_PRINTK && CONFIG_SYSCTL */
213214
214215 /* Number of registered extended console drivers. */
215216 static int nr_ext_console_drivers;