From nobody Wed May 1 22:49:17 2024 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19D42C76195 for ; Tue, 28 Mar 2023 12:22:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231990AbjC1MWz (ORCPT ); Tue, 28 Mar 2023 08:22:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbjC1MWx (ORCPT ); Tue, 28 Mar 2023 08:22:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB5F3F5 for ; Tue, 28 Mar 2023 05:22:52 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id 7931AB81CA5 for ; Tue, 28 Mar 2023 12:22:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE77BC433D2; Tue, 28 Mar 2023 12:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680006170; bh=SrusFfYKuzb9qJ1fPuyyiI19ee9dDYsDkKxhBfXFx60=; h=From:To:Cc:Subject:Date:From; b=FwXsEXEKogNnEjhyVpejwrEZ8M64Nhw0cflqOr9Hmq6LC/yls6YXwaSpuQ0P5tr6Q AP3JT+IbBllwzb35HlxZZ9FQ1rTezdgMnd0wdKLFbARifI9LgkrXRB6qEqnMMPyxk3 zP6MBisI4s1Ty6JEt1spwm2NkTTeAii0zZV2qG0IrJBuAJ7BEr0P8qMnXURz5lLizr b2ZUPRedrt6HC3RWrotpNbK5RjpLXR0GS5uceaC9cfElhah/u2ueUU3Ce0dGVcbAdp DjyKxE8oTOqWoyJpfI+Ng50JkoUlX7u3caqQtofmtt9bm9YCnb0NIRa4wfCbF0eGkD REoTjHud0n/vg== From: Arnd Bergmann To: Jan Kara , Yangtao Li Cc: Arnd Bergmann , Christian Brauner , Seth Forshee , Dave Chinner , Roman Gushchin , Baokun Li , "Matthew Wilcox (Oracle)" , Luis Chamberlain , linux-kernel@vger.kernel.org Subject: [PATCH] fs: quota: avoid unused function warning for !CONFIG_SYSCTL Date: Tue, 28 Mar 2023 14:22:31 +0200 Message-Id: <20230328122244.2521387-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann Having fs_dqstats_table[] inside of an #ifdef causes a build time warning: fs/quota/dquot.c:2864:12: error: 'do_proc_dqstats' defined but not used [-W= error=3Dunused-function] 2864 | static int do_proc_dqstats(struct ctl_table *table, int write, Avoid this by using an IS_ENABLED() check in place of the #ifdef, giving the compiler a better idea of how it is used. Fixes: 63d00e08515b ("quota: check for register_sysctl() failure") Signed-off-by: Arnd Bergmann --- Note: it may be better to just revert the 63d00e08515b patch, as the additional pr_notice() does not seem to add much value after the pr_err() printed by register_sysctl() that tells us exactly what went wrong. --- fs/quota/dquot.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 05bed02b257f..6e9109c6218e 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -2877,7 +2877,6 @@ static int do_proc_dqstats(struct ctl_table *table, i= nt write, return proc_doulongvec_minmax(table, write, buffer, lenp, ppos); } =20 -#ifdef CONFIG_SYSCTL static struct ctl_table fs_dqstats_table[] =3D { { .procname =3D "lookups", @@ -2946,7 +2945,6 @@ static struct ctl_table fs_dqstats_table[] =3D { #endif { }, }; -#endif =20 static int __init dquot_init(void) { @@ -2955,10 +2953,10 @@ static int __init dquot_init(void) =20 printk(KERN_NOTICE "VFS: Disk quotas %s\n", __DQUOT_VERSION__); =20 -#ifdef CONFIG_SYSCTL - if (!register_sysctl("fs/quota", fs_dqstats_table)) - pr_notice("quota sysctl registration failed!\n"); -#endif + if (IS_ENABLED(CONFIG_SYSCTL)) { + if (!register_sysctl("fs/quota", fs_dqstats_table)) + pr_notice("quota sysctl registration failed!\n"); + } =20 dquot_cachep =3D kmem_cache_create("dquot", sizeof(struct dquot), sizeof(unsigned long) * 4, --=20 2.39.2