From patchwork Sat Jan 22 06:13:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12720520 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73423C433FE for ; Sat, 22 Jan 2022 06:13:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 10CDD6B00C8; Sat, 22 Jan 2022 01:13:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 047286B00C9; Sat, 22 Jan 2022 01:13:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E29EA6B00CA; Sat, 22 Jan 2022 01:13:42 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0080.hostedemail.com [216.40.44.80]) by kanga.kvack.org (Postfix) with ESMTP id D26966B00C8 for ; Sat, 22 Jan 2022 01:13:42 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id A0280181C43A9 for ; Sat, 22 Jan 2022 06:13:42 +0000 (UTC) X-FDA: 79056906684.30.67C1500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id 26CC812001E for ; Sat, 22 Jan 2022 06:13:36 +0000 (UTC) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E2D360ED1; Sat, 22 Jan 2022 06:13:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43328C004E1; Sat, 22 Jan 2022 06:13:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1642832015; bh=cIGG0JpRHjSN1E9Wba5CzZDpZUgTiuPImtGCAuN8YDU=; h=Date:From:To:Subject:In-Reply-To:From; b=qY3ev5W9XUHB++tXBakSRwqVRVKW+k5+Ny1VzZrKGWe+zg90Gpi6Zs8Gsri+pjdF3 x2ERqshzAhvuL1e1EI9vwMaAJvOHXAqnS9zfuyq90q7j1n+njrvDLxxrFX/vff3I+T FxzXICo+hn+UtwA+Ab73sazn1X4RinSglhLFppRQ= Date: Fri, 21 Jan 2022 22:13:34 -0800 From: Andrew Morton To: akpm@linux-foundation.org, anil.s.keshavamurthy@intel.com, christian.brauner@ubuntu.com, crope@iki.fi, davem@davemloft.net, ebiederm@xmission.com, ebiggers@google.com, keescook@chromium.org, kernel@tuxforce.de, linux-mm@kvack.org, mcgrof@kernel.org, mhiramat@kernel.org, mm-commits@vger.kernel.org, naveen.n.rao@linux.ibm.com, nixiaoming@huawei.com, steve@sk2.org, torvalds@linux-foundation.org, viro@zeniv.linux.org.uk, yzaikin@google.com Subject: [patch 39/69] printk: fix build warning when CONFIG_PRINTK=n Message-ID: <20220122061334.TbZe0CqSn%akpm@linux-foundation.org> In-Reply-To: <20220121221021.60533b009c357d660791476e@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=qY3ev5W9; dmarc=none; spf=pass (imf29.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Stat-Signature: 3ij15r5ufxjdqeej6pnqct4kr19qot4x X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 26CC812001E X-HE-Tag: 1642832016-540482 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Xiaoming Ni Subject: 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. Link: https://lkml.kernel.org/r/20211129211943.640266-5-mcgrof@kernel.org Signed-off-by: Xiaoming Ni Signed-off-by: Luis Chamberlain Cc: Al Viro Cc: Anil S Keshavamurthy Cc: Antti Palosaari Cc: Christian Brauner Cc: "David S. Miller" Cc: Eric Biederman Cc: Eric Biggers Cc: Iurii Zaikin Cc: Kees Cook Cc: Lukas Middendorf Cc: Masami Hiramatsu Cc: "Naveen N. Rao" Cc: Stephen Kitt Signed-off-by: Andrew Morton --- include/linux/printk.h | 4 ---- kernel/printk/internal.h | 2 ++ kernel/printk/printk.c | 3 ++- 3 files changed, 4 insertions(+), 5 deletions(-) --- a/include/linux/printk.h~printk-fix-build-warning-when-config_printk=n +++ a/include/linux/printk.h @@ -183,10 +183,6 @@ extern bool printk_timed_ratelimit(unsig extern int printk_delay_msec; extern int dmesg_restrict; -extern int -devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void *buf, - size_t *lenp, loff_t *ppos); - extern void wake_up_klogd(void); char *log_buf_addr_get(void); --- a/kernel/printk/internal.h~printk-fix-build-warning-when-config_printk=n +++ a/kernel/printk/internal.h @@ -6,6 +6,8 @@ #if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL) void __init printk_sysctl_init(void); +int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos); #else #define printk_sysctl_init() do { } while (0) #endif --- a/kernel/printk/printk.c~printk-fix-build-warning-when-config_printk=n +++ a/kernel/printk/printk.c @@ -171,7 +171,7 @@ static int __init control_devkmsg(char * __setup("printk.devkmsg=", control_devkmsg); char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE] = "ratelimit"; - +#if defined(CONFIG_PRINTK) && defined(CONFIG_SYSCTL) int devkmsg_sysctl_set_loglvl(struct ctl_table *table, int write, void *buffer, size_t *lenp, loff_t *ppos) { @@ -210,6 +210,7 @@ int devkmsg_sysctl_set_loglvl(struct ctl return 0; } +#endif /* CONFIG_PRINTK && CONFIG_SYSCTL */ /* Number of registered extended console drivers. */ static int nr_ext_console_drivers;