From mboxrd@z Thu Jan 1 00:00:00 1970 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 143F0C433F5 for ; Thu, 20 Jan 2022 02:08:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 993B66B0080; Wed, 19 Jan 2022 21:08:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 942B96B0081; Wed, 19 Jan 2022 21:08:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80A296B0082; Wed, 19 Jan 2022 21:08:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0140.hostedemail.com [216.40.44.140]) by kanga.kvack.org (Postfix) with ESMTP id 7084B6B0080 for ; Wed, 19 Jan 2022 21:08:04 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 2FEB4181CB2CC for ; Thu, 20 Jan 2022 02:08:04 +0000 (UTC) X-FDA: 79049030088.08.4FA9250 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf13.hostedemail.com (Postfix) with ESMTP id B602820021 for ; Thu, 20 Jan 2022 02:08:03 +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 ams.source.kernel.org (Postfix) with ESMTPS id 93B63B81911; Thu, 20 Jan 2022 02:08:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DEA05C004E1; Thu, 20 Jan 2022 02:08:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1642644481; bh=S7e8CuGvJPJ35GtdLmKgBe36jQTkMKEoJL47rd69lXM=; h=Date:From:To:Subject:In-Reply-To:From; b=gKRapUQjGGOrDfb63tghnJqxmS5uuXiq6+yH4U5rg0W5ThQrerMgdcLCVxtEfy/6p D4e0AzivS1rILUAKgUTPaUXkhem5vgT+cc5/EK6uK2LOfcuZDJGD9kEJN8YHST8EtB XdXgEv3J0o0WTDrB7LwP89sRKGsQDCGK4/t6i0oQ= Date: Wed, 19 Jan 2022 18:08:00 -0800 From: Andrew Morton To: akpm@linux-foundation.org, christian.brauner@ubuntu.com, dhowells@redhat.com, hch@infradead.org, hdegoede@redhat.com, linux-mm@kvack.org, lkp@intel.com, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, viro@zeniv.linux.org.uk Subject: [patch 06/55] proc: make the proc_create[_data]() stubs static inlines Message-ID: <20220120020800.1TImEbrhi%akpm@linux-foundation.org> In-Reply-To: <20220119180714.9e187ce100e4510de3cd9f7d@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Queue-Id: B602820021 X-Stat-Signature: bag8gc3xn75itujzeubw9g71ipo9ngjf Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=gKRapUQj; dmarc=none; spf=pass (imf13.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam08 X-HE-Tag: 1642644483-508071 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: Hans de Goede Subject: proc: make the proc_create[_data]() stubs static inlines Change the proc_create[_data]() stubs which are used when CONFIG_PROC_FS is not set from #defines to a static inline stubs. Thix should fix clang -Werror builds failing due to errors like this: drivers/platform/x86/thinkpad_acpi.c:918:30: error: unused variable 'dispatch_proc_ops' [-Werror,-Wunused-const-variable] Fixing this in include/linux/proc_fs.h should ensure that the same issue is also fixed in any other drivers hitting the same -Werror issue. [akpm@linux-foundation.org: fix CONFIG_PROC_FS=n] [akpm@linux-foundation.org: fix arch/sparc/kernel/led.c] [akpm@linux-foundation.org: fix build] Link: https://lkml.kernel.org/r/20211116131112.508304-1-hdegoede@redhat.com Signed-off-by: Hans de Goede Reported-by: kernel test robot Acked-by: Christian Brauner Cc: Alexander Viro Cc: Hans de Goede Cc: David Howells Cc: Christoph Hellwig Signed-off-by: Andrew Morton --- arch/sparc/kernel/led.c | 8 +++----- include/linux/proc_fs.h | 12 ++++++++++-- 2 files changed, 13 insertions(+), 7 deletions(-) --- a/arch/sparc/kernel/led.c~proc-make-the-proc_create-stubs-static-inlines +++ a/arch/sparc/kernel/led.c @@ -114,18 +114,16 @@ static const struct proc_ops led_proc_op }; #endif -static struct proc_dir_entry *led; - #define LED_VERSION "0.1" static int __init led_init(void) { timer_setup(&led_blink_timer, led_blink, 0); - led = proc_create("led", 0, NULL, &led_proc_ops); - if (!led) +#ifdef CONFIG_PROC_FS + if (!proc_create("led", 0, NULL, &led_proc_ops)) return -ENOMEM; - +#endif printk(KERN_INFO "led: version %s, Lars Kotthoff \n", LED_VERSION); --- a/include/linux/proc_fs.h~proc-make-the-proc_create-stubs-static-inlines +++ a/include/linux/proc_fs.h @@ -178,8 +178,16 @@ static inline struct proc_dir_entry *pro #define proc_create_seq(name, mode, parent, ops) ({NULL;}) #define proc_create_single(name, mode, parent, show) ({NULL;}) #define proc_create_single_data(name, mode, parent, show, data) ({NULL;}) -#define proc_create(name, mode, parent, proc_ops) ({NULL;}) -#define proc_create_data(name, mode, parent, proc_ops, data) ({NULL;}) + +static inline struct proc_dir_entry * +proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, + const struct proc_ops *proc_ops) +{ return NULL; } + +static inline struct proc_dir_entry * +proc_create_data(const char *name, umode_t mode, struct proc_dir_entry *parent, + const struct proc_ops *proc_ops, void *data) +{ return NULL; } static inline void proc_set_size(struct proc_dir_entry *de, loff_t size) {} static inline void proc_set_user(struct proc_dir_entry *de, kuid_t uid, kgid_t gid) {} _