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 /sound/soc/soc-dapm.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 'sound/soc/soc-dapm.c')
-rw-r--r-- | sound/soc/soc-dapm.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 6241490fff30..5cbd2d7623b8 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1544,12 +1544,6 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event) | |||
1544 | } | 1544 | } |
1545 | 1545 | ||
1546 | #ifdef CONFIG_DEBUG_FS | 1546 | #ifdef CONFIG_DEBUG_FS |
1547 | static int dapm_widget_power_open_file(struct inode *inode, struct file *file) | ||
1548 | { | ||
1549 | file->private_data = inode->i_private; | ||
1550 | return 0; | ||
1551 | } | ||
1552 | |||
1553 | static ssize_t dapm_widget_power_read_file(struct file *file, | 1547 | static ssize_t dapm_widget_power_read_file(struct file *file, |
1554 | char __user *user_buf, | 1548 | char __user *user_buf, |
1555 | size_t count, loff_t *ppos) | 1549 | size_t count, loff_t *ppos) |
@@ -1613,17 +1607,11 @@ static ssize_t dapm_widget_power_read_file(struct file *file, | |||
1613 | } | 1607 | } |
1614 | 1608 | ||
1615 | static const struct file_operations dapm_widget_power_fops = { | 1609 | static const struct file_operations dapm_widget_power_fops = { |
1616 | .open = dapm_widget_power_open_file, | 1610 | .open = simple_open, |
1617 | .read = dapm_widget_power_read_file, | 1611 | .read = dapm_widget_power_read_file, |
1618 | .llseek = default_llseek, | 1612 | .llseek = default_llseek, |
1619 | }; | 1613 | }; |
1620 | 1614 | ||
1621 | static int dapm_bias_open_file(struct inode *inode, struct file *file) | ||
1622 | { | ||
1623 | file->private_data = inode->i_private; | ||
1624 | return 0; | ||
1625 | } | ||
1626 | |||
1627 | static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf, | 1615 | static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf, |
1628 | size_t count, loff_t *ppos) | 1616 | size_t count, loff_t *ppos) |
1629 | { | 1617 | { |
@@ -1654,7 +1642,7 @@ static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf, | |||
1654 | } | 1642 | } |
1655 | 1643 | ||
1656 | static const struct file_operations dapm_bias_fops = { | 1644 | static const struct file_operations dapm_bias_fops = { |
1657 | .open = dapm_bias_open_file, | 1645 | .open = simple_open, |
1658 | .read = dapm_bias_read_file, | 1646 | .read = dapm_bias_read_file, |
1659 | .llseek = default_llseek, | 1647 | .llseek = default_llseek, |
1660 | }; | 1648 | }; |