diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2012-04-05 17:25:11 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-04-05 18:25:50 -0400 |
commit | 234e340582901211f40d8c732afc49f0630ecf05 (patch) | |
tree | 753076500dfd883b3db56d4f5410af31d8945623 /drivers/net/wimax/i2400m/debugfs.c | |
parent | 9b3ae64be658a573b33d05a8dc73b08d3345fa44 (diff) |
simple_open: automatically convert to simple_open()
Many users of debugfs copy the implementation of default_open() when
they want to support a custom read/write function op. This leads to a
proliferation of the default_open() implementation across the entire
tree.
Now that the common implementation has been consolidated into libfs we
can replace all the users of this function with simple_open().
This replacement was done with the following semantic patch:
<smpl>
@ open @
identifier open_f != simple_open;
identifier i, f;
@@
-int open_f(struct inode *i, struct file *f)
-{
(
-if (i->i_private)
-f->private_data = i->i_private;
|
-f->private_data = i->i_private;
)
-return 0;
-}
@ has_open depends on open @
identifier fops;
identifier open.open_f;
@@
struct file_operations fops = {
...
-.open = open_f,
+.open = simple_open,
...
};
</smpl>
[akpm@linux-foundation.org: checkpatch fixes]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/net/wimax/i2400m/debugfs.c')
-rw-r--r-- | drivers/net/wimax/i2400m/debugfs.c | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/drivers/net/wimax/i2400m/debugfs.c b/drivers/net/wimax/i2400m/debugfs.c index 129ba36bd04d..4b66ab1d0e5c 100644 --- a/drivers/net/wimax/i2400m/debugfs.c +++ b/drivers/net/wimax/i2400m/debugfs.c | |||
@@ -53,17 +53,6 @@ struct dentry *debugfs_create_netdev_queue_stopped( | |||
53 | &fops_netdev_queue_stopped); | 53 | &fops_netdev_queue_stopped); |
54 | } | 54 | } |
55 | 55 | ||
56 | |||
57 | /* | ||
58 | * inode->i_private has the @data argument to debugfs_create_file() | ||
59 | */ | ||
60 | static | ||
61 | int i2400m_stats_open(struct inode *inode, struct file *filp) | ||
62 | { | ||
63 | filp->private_data = inode->i_private; | ||
64 | return 0; | ||
65 | } | ||
66 | |||
67 | /* | 56 | /* |
68 | * We don't allow partial reads of this file, as then the reader would | 57 | * We don't allow partial reads of this file, as then the reader would |
69 | * get weirdly confused data as it is updated. | 58 | * get weirdly confused data as it is updated. |
@@ -117,7 +106,7 @@ ssize_t i2400m_rx_stats_write(struct file *filp, const char __user *buffer, | |||
117 | static | 106 | static |
118 | const struct file_operations i2400m_rx_stats_fops = { | 107 | const struct file_operations i2400m_rx_stats_fops = { |
119 | .owner = THIS_MODULE, | 108 | .owner = THIS_MODULE, |
120 | .open = i2400m_stats_open, | 109 | .open = simple_open, |
121 | .read = i2400m_rx_stats_read, | 110 | .read = i2400m_rx_stats_read, |
122 | .write = i2400m_rx_stats_write, | 111 | .write = i2400m_rx_stats_write, |
123 | .llseek = default_llseek, | 112 | .llseek = default_llseek, |
@@ -170,7 +159,7 @@ ssize_t i2400m_tx_stats_write(struct file *filp, const char __user *buffer, | |||
170 | static | 159 | static |
171 | const struct file_operations i2400m_tx_stats_fops = { | 160 | const struct file_operations i2400m_tx_stats_fops = { |
172 | .owner = THIS_MODULE, | 161 | .owner = THIS_MODULE, |
173 | .open = i2400m_stats_open, | 162 | .open = simple_open, |
174 | .read = i2400m_tx_stats_read, | 163 | .read = i2400m_tx_stats_read, |
175 | .write = i2400m_tx_stats_write, | 164 | .write = i2400m_tx_stats_write, |
176 | .llseek = default_llseek, | 165 | .llseek = default_llseek, |