Skip to content

Commit

Permalink
[PATCH] debugfs: Reduce <linux/debugfs.h> dependencies
Browse files Browse the repository at this point in the history
The current <linux/debugfs.h> include file is a little fragile in that
it is not self-contained and hence may cause compile warnings or
errors depending on the files included before it, the kernel config
and the architecture.  This patch makes things a little more robust by:

 - including <linux/types.h> to get definitions of u32, mode_t, and so on.
 - forward declaring struct file_operations.
 - including <linux/err.h> when CONFIG_DEBUG_FS is not set

The last change is particularly useful, as a kernel developer is
likely to build with debugfs always enabled and never see the build
breakage cased if debugfs is disabled.

Signed-off-by: Roland Dreier <roland@topspin.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Roland Dreier authored and Greg KH committed Apr 19, 2005
1 parent 1694145 commit a7a76ce
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/linux/debugfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@

#include <linux/fs.h>

#include <linux/types.h>

struct file_operations;

#if defined(CONFIG_DEBUG_FS)
struct dentry *debugfs_create_file(const char *name, mode_t mode,
struct dentry *parent, void *data,
Expand All @@ -36,6 +40,9 @@ struct dentry *debugfs_create_bool(const char *name, mode_t mode,
struct dentry *parent, u32 *value);

#else

#include <linux/err.h>

/*
* We do not return NULL from these functions if CONFIG_DEBUG_FS is not enabled
* so users have a chance to detect if there was a real error or not. We don't
Expand Down

0 comments on commit a7a76ce

Please sign in to comment.