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/bluetooth | |
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/bluetooth')
-rw-r--r-- | drivers/bluetooth/btmrvl_debugfs.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/bluetooth/btmrvl_debugfs.c b/drivers/bluetooth/btmrvl_debugfs.c index 6c20bbb54b71..428dbb7574bd 100644 --- a/drivers/bluetooth/btmrvl_debugfs.c +++ b/drivers/bluetooth/btmrvl_debugfs.c | |||
@@ -45,12 +45,6 @@ struct btmrvl_debugfs_data { | |||
45 | struct dentry *txdnldready; | 45 | struct dentry *txdnldready; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | static int btmrvl_open_generic(struct inode *inode, struct file *file) | ||
49 | { | ||
50 | file->private_data = inode->i_private; | ||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | static ssize_t btmrvl_hscfgcmd_write(struct file *file, | 48 | static ssize_t btmrvl_hscfgcmd_write(struct file *file, |
55 | const char __user *ubuf, size_t count, loff_t *ppos) | 49 | const char __user *ubuf, size_t count, loff_t *ppos) |
56 | { | 50 | { |
@@ -93,7 +87,7 @@ static ssize_t btmrvl_hscfgcmd_read(struct file *file, char __user *userbuf, | |||
93 | static const struct file_operations btmrvl_hscfgcmd_fops = { | 87 | static const struct file_operations btmrvl_hscfgcmd_fops = { |
94 | .read = btmrvl_hscfgcmd_read, | 88 | .read = btmrvl_hscfgcmd_read, |
95 | .write = btmrvl_hscfgcmd_write, | 89 | .write = btmrvl_hscfgcmd_write, |
96 | .open = btmrvl_open_generic, | 90 | .open = simple_open, |
97 | .llseek = default_llseek, | 91 | .llseek = default_llseek, |
98 | }; | 92 | }; |
99 | 93 | ||
@@ -134,7 +128,7 @@ static ssize_t btmrvl_psmode_read(struct file *file, char __user *userbuf, | |||
134 | static const struct file_operations btmrvl_psmode_fops = { | 128 | static const struct file_operations btmrvl_psmode_fops = { |
135 | .read = btmrvl_psmode_read, | 129 | .read = btmrvl_psmode_read, |
136 | .write = btmrvl_psmode_write, | 130 | .write = btmrvl_psmode_write, |
137 | .open = btmrvl_open_generic, | 131 | .open = simple_open, |
138 | .llseek = default_llseek, | 132 | .llseek = default_llseek, |
139 | }; | 133 | }; |
140 | 134 | ||
@@ -180,7 +174,7 @@ static ssize_t btmrvl_pscmd_read(struct file *file, char __user *userbuf, | |||
180 | static const struct file_operations btmrvl_pscmd_fops = { | 174 | static const struct file_operations btmrvl_pscmd_fops = { |
181 | .read = btmrvl_pscmd_read, | 175 | .read = btmrvl_pscmd_read, |
182 | .write = btmrvl_pscmd_write, | 176 | .write = btmrvl_pscmd_write, |
183 | .open = btmrvl_open_generic, | 177 | .open = simple_open, |
184 | .llseek = default_llseek, | 178 | .llseek = default_llseek, |
185 | }; | 179 | }; |
186 | 180 | ||
@@ -221,7 +215,7 @@ static ssize_t btmrvl_gpiogap_read(struct file *file, char __user *userbuf, | |||
221 | static const struct file_operations btmrvl_gpiogap_fops = { | 215 | static const struct file_operations btmrvl_gpiogap_fops = { |
222 | .read = btmrvl_gpiogap_read, | 216 | .read = btmrvl_gpiogap_read, |
223 | .write = btmrvl_gpiogap_write, | 217 | .write = btmrvl_gpiogap_write, |
224 | .open = btmrvl_open_generic, | 218 | .open = simple_open, |
225 | .llseek = default_llseek, | 219 | .llseek = default_llseek, |
226 | }; | 220 | }; |
227 | 221 | ||
@@ -265,7 +259,7 @@ static ssize_t btmrvl_hscmd_read(struct file *file, char __user *userbuf, | |||
265 | static const struct file_operations btmrvl_hscmd_fops = { | 259 | static const struct file_operations btmrvl_hscmd_fops = { |
266 | .read = btmrvl_hscmd_read, | 260 | .read = btmrvl_hscmd_read, |
267 | .write = btmrvl_hscmd_write, | 261 | .write = btmrvl_hscmd_write, |
268 | .open = btmrvl_open_generic, | 262 | .open = simple_open, |
269 | .llseek = default_llseek, | 263 | .llseek = default_llseek, |
270 | }; | 264 | }; |
271 | 265 | ||
@@ -305,7 +299,7 @@ static ssize_t btmrvl_hsmode_read(struct file *file, char __user * userbuf, | |||
305 | static const struct file_operations btmrvl_hsmode_fops = { | 299 | static const struct file_operations btmrvl_hsmode_fops = { |
306 | .read = btmrvl_hsmode_read, | 300 | .read = btmrvl_hsmode_read, |
307 | .write = btmrvl_hsmode_write, | 301 | .write = btmrvl_hsmode_write, |
308 | .open = btmrvl_open_generic, | 302 | .open = simple_open, |
309 | .llseek = default_llseek, | 303 | .llseek = default_llseek, |
310 | }; | 304 | }; |
311 | 305 | ||
@@ -323,7 +317,7 @@ static ssize_t btmrvl_curpsmode_read(struct file *file, char __user *userbuf, | |||
323 | 317 | ||
324 | static const struct file_operations btmrvl_curpsmode_fops = { | 318 | static const struct file_operations btmrvl_curpsmode_fops = { |
325 | .read = btmrvl_curpsmode_read, | 319 | .read = btmrvl_curpsmode_read, |
326 | .open = btmrvl_open_generic, | 320 | .open = simple_open, |
327 | .llseek = default_llseek, | 321 | .llseek = default_llseek, |
328 | }; | 322 | }; |
329 | 323 | ||
@@ -341,7 +335,7 @@ static ssize_t btmrvl_psstate_read(struct file *file, char __user * userbuf, | |||
341 | 335 | ||
342 | static const struct file_operations btmrvl_psstate_fops = { | 336 | static const struct file_operations btmrvl_psstate_fops = { |
343 | .read = btmrvl_psstate_read, | 337 | .read = btmrvl_psstate_read, |
344 | .open = btmrvl_open_generic, | 338 | .open = simple_open, |
345 | .llseek = default_llseek, | 339 | .llseek = default_llseek, |
346 | }; | 340 | }; |
347 | 341 | ||
@@ -359,7 +353,7 @@ static ssize_t btmrvl_hsstate_read(struct file *file, char __user *userbuf, | |||
359 | 353 | ||
360 | static const struct file_operations btmrvl_hsstate_fops = { | 354 | static const struct file_operations btmrvl_hsstate_fops = { |
361 | .read = btmrvl_hsstate_read, | 355 | .read = btmrvl_hsstate_read, |
362 | .open = btmrvl_open_generic, | 356 | .open = simple_open, |
363 | .llseek = default_llseek, | 357 | .llseek = default_llseek, |
364 | }; | 358 | }; |
365 | 359 | ||
@@ -378,7 +372,7 @@ static ssize_t btmrvl_txdnldready_read(struct file *file, char __user *userbuf, | |||
378 | 372 | ||
379 | static const struct file_operations btmrvl_txdnldready_fops = { | 373 | static const struct file_operations btmrvl_txdnldready_fops = { |
380 | .read = btmrvl_txdnldready_read, | 374 | .read = btmrvl_txdnldready_read, |
381 | .open = btmrvl_open_generic, | 375 | .open = simple_open, |
382 | .llseek = default_llseek, | 376 | .llseek = default_llseek, |
383 | }; | 377 | }; |
384 | 378 | ||