* [PATCH] proc: Make the proc_create[_data]() stubs static inlines
@ 2021-11-16 13:11 Hans de Goede
2021-11-19 13:48 ` Christian Brauner
0 siblings, 1 reply; 2+ messages in thread
From: Hans de Goede @ 2021-11-16 13:11 UTC (permalink / raw)
To: Christian Brauner, Alexander Viro
Cc: Hans de Goede, David Howells, Christoph Hellwig, Andrew Morton,
linux-fsdevel, platform-driver-x86, kernel test robot
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.
Cc: platform-driver-x86@vger.kernel.org
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
Note the commit message says "should fix" because I could not actually
be bothered to verify this. The whole notion of combining:
1. clang
2. -Werror
3. -Wunused-const-variable
Is frankly a bit crazy, causing way too much noise and has already
cost me too much time IMHO.
---
include/linux/proc_fs.h | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 069c7fd95396..3d19453fb6b3 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -178,8 +178,14 @@ static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
#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 *, umode_t, struct proc_dir_entry *, const struct proc_ops *)
+{ return NULL; }
+
+static inline struct proc_dir_entry *proc_create_data(
+ const char *, umode_t, struct proc_dir_entry *, const struct proc_ops *, void *)
+{ 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) {}
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] proc: Make the proc_create[_data]() stubs static inlines
2021-11-16 13:11 [PATCH] proc: Make the proc_create[_data]() stubs static inlines Hans de Goede
@ 2021-11-19 13:48 ` Christian Brauner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2021-11-19 13:48 UTC (permalink / raw)
To: Hans de Goede
Cc: Christian Brauner, Alexander Viro, David Howells,
Christoph Hellwig, Andrew Morton, linux-fsdevel,
platform-driver-x86, kernel test robot
On Tue, Nov 16, 2021 at 02:11:12PM +0100, Hans de Goede wrote:
> 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.
>
> Cc: platform-driver-x86@vger.kernel.org
> Reported-by: kernel test robot <lkp@intel.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
Hmkay, seems ok if this is required to please clang with -Werror.
Also using statement expressions to implement these nop helpers for
!CONFIG_PROC_FS seems a bit strange to me in the first place. Especially
since they seem to be sprinkled in alongside other static inline nops.
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
> Note the commit message says "should fix" because I could not actually
> be bothered to verify this. The whole notion of combining:
> 1. clang
> 2. -Werror
> 3. -Wunused-const-variable
> Is frankly a bit crazy, causing way too much noise and has already
> cost me too much time IMHO.
> ---
> include/linux/proc_fs.h | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
> index 069c7fd95396..3d19453fb6b3 100644
> --- a/include/linux/proc_fs.h
> +++ b/include/linux/proc_fs.h
> @@ -178,8 +178,14 @@ static inline struct proc_dir_entry *proc_mkdir_mode(const char *name,
> #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 *, umode_t, struct proc_dir_entry *, const struct proc_ops *)
> +{ return NULL; }
> +
> +static inline struct proc_dir_entry *proc_create_data(
> + const char *, umode_t, struct proc_dir_entry *, const struct proc_ops *, void *)
> +{ 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) {}
> --
> 2.31.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-19 13:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-16 13:11 [PATCH] proc: Make the proc_create[_data]() stubs static inlines Hans de Goede
2021-11-19 13:48 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).