Skip to contentSkip to conversation

kernfs: add stub helper for kernfs_generic_poll()

PATCH In review Arnd Bergmann 2 participants 2 messages Jul 24, 2023 kernfs

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kernfs: add stub helper for kernfs_generic_poll()

From: Arnd Bergmann <[email protected]>

In some randconfig builds, kernfs ends up being disabled, so there is no prototype for kernfs_generic_poll()

In file included from kernel/sched/build_utility.c:97:
kernel/sched/psi.c:1479:3: error: implicit declaration of function 'kernfs_generic_poll' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                kernfs_generic_poll(t->of, wait);
                ^

Add a stub helper for it, as we have it for other kernfs functions.

Fixes aff037078ecae ("sched/psi: use kernfs polling functions for PSI trigger polling")
Fixes 147e1a97c4a0b ("fs: kernfs: add poll file operation")

---
While the stub was always missing, this only caused problems now that sched/psi.c calls it unconditionally. The patch that caused it was already merged into v6.5-rc2

---
 include/linux/kernfs.h | 4 ++++
 1 file changed, 4 insertions(+)
include/linux/kernfs.h +4 -0
index 73f5c120def88..2a36f3218b510 100644
@@ -550,6 +550,10 @@ static inline int kernfs_setattr(struct kernfs_node *kn,
 				 const struct iattr *iattr)
 { return -ENOSYS; }
 
+static inline __poll_t kernfs_generic_poll(struct kernfs_open_file *of,
+					   struct poll_table_struct *pt)
+{ return -ENOSYS; }
+
 static inline void kernfs_notify(struct kernfs_node *kn) { }
 
 static inline int kernfs_xattr_get(struct kernfs_node *kn, const char *name,
Signature · 1 line
2.39.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 27 lines · Arnd Bergmann

From: Arnd Bergmann <[email protected]>

In some randconfig builds, kernfs ends up being disabled, so there is no prototype for kernfs_generic_poll()

In file included from kernel/sched/build_utility.c:97:
kernel/sched/psi.c:1479:3: error: implicit declaration of function 'kernfs_generic_poll' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

                kernfs_generic_poll(t->of, wait);
                ^

Add a stub helper for it, as we have it for other kernfs functions.

Fixes aff037078ecae ("sched/psi: use kernfs polling functions for PSI trigger polling")
Fixes 147e1a97c4a0b ("fs: kernfs: add poll file operation")

---
While the stub was always missing, this only caused problems now that sched/psi.c calls it unconditionally. The patch that caused it was already merged into v6.5-rc2

---
 include/linux/kernfs.h | 4 ++++
 1 file changed, 4 insertions(+)
include/linux/kernfs.h +0 -0
index 73f5c120def88..2a36f3218b510 100644

include/linux/kernfs.h static inline int kernfs_setattr(struct kernfs_node *kn, · line 559

Quoted 10 lines
include/linux/kernfs.h +4 -0
@@ -550,6 +550,10 @@ static inline int kernfs_setattr(struct kernfs_node *kn,
 				 const struct iattr *iattr)
 { return -ENOSYS; }
 
+static inline __poll_t kernfs_generic_poll(struct kernfs_open_file *of,
+					   struct poll_table_struct *pt)
+{ return -ENOSYS; }
+
 static inline void kernfs_notify(struct kernfs_node *kn) { }
 
 static inline int kernfs_xattr_get(struct kernfs_node *kn, const char *name,

Thanks.