aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorStephen Boyd <sboyd@codeaurora.org>2012-04-05 17:25:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-05 18:25:50 -0400
commit234e340582901211f40d8c732afc49f0630ecf05 (patch)
tree753076500dfd883b3db56d4f5410af31d8945623 /drivers/mfd
parent9b3ae64be658a573b33d05a8dc73b08d3345fa44 (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/mfd')
-rw-r--r--drivers/mfd/aat2870-core.c9
-rw-r--r--drivers/mfd/ab3100-core.c8
2 files changed, 2 insertions, 15 deletions
diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c
index 3aa36eb5c79b..44a3fdbadef4 100644
--- a/drivers/mfd/aat2870-core.c
+++ b/drivers/mfd/aat2870-core.c
@@ -262,13 +262,6 @@ static ssize_t aat2870_dump_reg(struct aat2870_data *aat2870, char *buf)
262 return count; 262 return count;
263} 263}
264 264
265static int aat2870_reg_open_file(struct inode *inode, struct file *file)
266{
267 file->private_data = inode->i_private;
268
269 return 0;
270}
271
272static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf, 265static ssize_t aat2870_reg_read_file(struct file *file, char __user *user_buf,
273 size_t count, loff_t *ppos) 266 size_t count, loff_t *ppos)
274{ 267{
@@ -330,7 +323,7 @@ static ssize_t aat2870_reg_write_file(struct file *file,
330} 323}
331 324
332static const struct file_operations aat2870_reg_fops = { 325static const struct file_operations aat2870_reg_fops = {
333 .open = aat2870_reg_open_file, 326 .open = simple_open,
334 .read = aat2870_reg_read_file, 327 .read = aat2870_reg_read_file,
335 .write = aat2870_reg_write_file, 328 .write = aat2870_reg_write_file,
336}; 329};
diff --git a/drivers/mfd/ab3100-core.c b/drivers/mfd/ab3100-core.c
index 60107ee166fc..1efad20fb175 100644
--- a/drivers/mfd/ab3100-core.c
+++ b/drivers/mfd/ab3100-core.c
@@ -483,12 +483,6 @@ struct ab3100_get_set_reg_priv {
483 bool mode; 483 bool mode;
484}; 484};
485 485
486static int ab3100_get_set_reg_open_file(struct inode *inode, struct file *file)
487{
488 file->private_data = inode->i_private;
489 return 0;
490}
491
492static ssize_t ab3100_get_set_reg(struct file *file, 486static ssize_t ab3100_get_set_reg(struct file *file,
493 const char __user *user_buf, 487 const char __user *user_buf,
494 size_t count, loff_t *ppos) 488 size_t count, loff_t *ppos)
@@ -583,7 +577,7 @@ static ssize_t ab3100_get_set_reg(struct file *file,
583} 577}
584 578
585static const struct file_operations ab3100_get_set_reg_fops = { 579static const struct file_operations ab3100_get_set_reg_fops = {
586 .open = ab3100_get_set_reg_open_file, 580 .open = simple_open,
587 .write = ab3100_get_set_reg, 581 .write = ab3100_get_set_reg,
588 .llseek = noop_llseek, 582 .llseek = noop_llseek,
589}; 583};