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

Showing the changes to kernel (2 of 3 files). Show all

Unified · Split

2 files
  1. kernel/printk/internal.h +2 −0
  2. kernel/printk/printk.c +2 −1
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;