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 | |
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')
-rw-r--r-- | sound/soc/imx/imx-audmux.c | 8 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 8 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 16 |
3 files changed, 4 insertions, 28 deletions
diff --git a/sound/soc/imx/imx-audmux.c b/sound/soc/imx/imx-audmux.c index 601df809a26a..1765a197acb0 100644 --- a/sound/soc/imx/imx-audmux.c +++ b/sound/soc/imx/imx-audmux.c | |||
@@ -40,12 +40,6 @@ static void __iomem *audmux_base; | |||
40 | #ifdef CONFIG_DEBUG_FS | 40 | #ifdef CONFIG_DEBUG_FS |
41 | static struct dentry *audmux_debugfs_root; | 41 | static struct dentry *audmux_debugfs_root; |
42 | 42 | ||
43 | static int audmux_open_file(struct inode *inode, struct file *file) | ||
44 | { | ||
45 | file->private_data = inode->i_private; | ||
46 | return 0; | ||
47 | } | ||
48 | |||
49 | /* There is an annoying discontinuity in the SSI numbering with regard | 43 | /* There is an annoying discontinuity in the SSI numbering with regard |
50 | * to the Linux number of the devices */ | 44 | * to the Linux number of the devices */ |
51 | static const char *audmux_port_string(int port) | 45 | static const char *audmux_port_string(int port) |
@@ -142,7 +136,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf, | |||
142 | } | 136 | } |
143 | 137 | ||
144 | static const struct file_operations audmux_debugfs_fops = { | 138 | static const struct file_operations audmux_debugfs_fops = { |
145 | .open = audmux_open_file, | 139 | .open = simple_open, |
146 | .read = audmux_read_file, | 140 | .read = audmux_read_file, |
147 | .llseek = default_llseek, | 141 | .llseek = default_llseek, |
148 | }; | 142 | }; |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a4deebc0801a..e19c24ade414 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -201,12 +201,6 @@ static ssize_t pmdown_time_set(struct device *dev, | |||
201 | static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set); | 201 | static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set); |
202 | 202 | ||
203 | #ifdef CONFIG_DEBUG_FS | 203 | #ifdef CONFIG_DEBUG_FS |
204 | static int codec_reg_open_file(struct inode *inode, struct file *file) | ||
205 | { | ||
206 | file->private_data = inode->i_private; | ||
207 | return 0; | ||
208 | } | ||
209 | |||
210 | static ssize_t codec_reg_read_file(struct file *file, char __user *user_buf, | 204 | static ssize_t codec_reg_read_file(struct file *file, char __user *user_buf, |
211 | size_t count, loff_t *ppos) | 205 | size_t count, loff_t *ppos) |
212 | { | 206 | { |
@@ -264,7 +258,7 @@ static ssize_t codec_reg_write_file(struct file *file, | |||
264 | } | 258 | } |
265 | 259 | ||
266 | static const struct file_operations codec_reg_fops = { | 260 | static const struct file_operations codec_reg_fops = { |
267 | .open = codec_reg_open_file, | 261 | .open = simple_open, |
268 | .read = codec_reg_read_file, | 262 | .read = codec_reg_read_file, |
269 | .write = codec_reg_write_file, | 263 | .write = codec_reg_write_file, |
270 | .llseek = default_llseek, | 264 | .llseek = default_llseek, |
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 | }; |