Skip to content

Commit f50caa9

Browse files
arndbgregkh
authored andcommitted
debugfs: fix debugfs_real_fops() build error
Some drivers use debugfs_real_fops() even when CONFIG_DEBUG_FS is disabled, which now leads to a build error: In file included from include/linux/list.h:9:0, from include/linux/wait.h:7, from include/linux/wait_bit.h:8, from include/linux/fs.h:6, from drivers/net/wireless/broadcom/b43legacy/debugfs.c:26: drivers/net/wireless/broadcom/b43legacy/debugfs.c: In function 'b43legacy_debugfs_read': drivers/net/wireless/broadcom/b43legacy/debugfs.c:224:23: error: implicit declaration of function 'debugfs_real_fops'; did you mean 'debugfs_create_bool'? [-Werror=implicit-function-declaration] My first impulse was to add another 'static inline' dummy function returning NULL for it, which would work fine. However, most callers feed the pointer into container_of(), so it seems a little dangerous here. Since all the callers are inside of a read/write file operation that gets eliminated in this configuration, so having an 'extern' declaration seems better here. If it ever gets used in a dangerous way, that will now result in a link error. Fixes: 7c8d469 ("debugfs: add support for more elaborate ->d_fsdata") Cc: Jakub Kicinski <[email protected]> Cc: Simon Horman <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4fbd8d1 commit f50caa9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

include/linux/debugfs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ static inline void debugfs_remove(struct dentry *dentry)
216216
static inline void debugfs_remove_recursive(struct dentry *dentry)
217217
{ }
218218

219+
const struct file_operations *debugfs_real_fops(const struct file *filp);
220+
219221
static inline int debugfs_file_get(struct dentry *dentry)
220222
{
221223
return 0;

0 commit comments

Comments
 (0)