summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorPeng Donglin <dolinux.peng@gmail.com>2018-02-14 22:48:07 +0800
committerMark Brown <broonie@kernel.org>2018-02-15 15:24:43 +0000
commitc15b2a1d185bcdab6556492b81b55ba9e658e201 (patch)
treeba5e7e74a36f563d74caa7e6689c97b4f6dd8f24 /sound/soc/soc-core.c
parent7a2ccad58106696b7909815cc7ab359ae2743bcc (diff)
downloadlinux-c15b2a1d185bcdab6556492b81b55ba9e658e201.tar.bz2
ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
There is some duplicate code in soc-core.c, and the kernel provides DEFINE_SHOW_ATTRIBUTE() helper macro to decrease it in seq_file.h. Signed-off-by: Peng Donglin <dolinux.peng@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c45
1 files changed, 6 insertions, 39 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 574048a73b1c..e1f047de599e 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -349,7 +349,7 @@ static void soc_init_codec_debugfs(struct snd_soc_component *component)
"ASoC: Failed to create codec register debugfs file\n");
}
-static int codec_list_seq_show(struct seq_file *m, void *v)
+static int codec_list_show(struct seq_file *m, void *v)
{
struct snd_soc_codec *codec;
@@ -362,20 +362,9 @@ static int codec_list_seq_show(struct seq_file *m, void *v)
return 0;
}
+DEFINE_SHOW_ATTRIBUTE(codec_list);
-static int codec_list_seq_open(struct inode *inode, struct file *file)
-{
- return single_open(file, codec_list_seq_show, NULL);
-}
-
-static const struct file_operations codec_list_fops = {
- .open = codec_list_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-static int dai_list_seq_show(struct seq_file *m, void *v)
+static int dai_list_show(struct seq_file *m, void *v)
{
struct snd_soc_component *component;
struct snd_soc_dai *dai;
@@ -390,20 +379,9 @@ static int dai_list_seq_show(struct seq_file *m, void *v)
return 0;
}
+DEFINE_SHOW_ATTRIBUTE(dai_list);
-static int dai_list_seq_open(struct inode *inode, struct file *file)
-{
- return single_open(file, dai_list_seq_show, NULL);
-}
-
-static const struct file_operations dai_list_fops = {
- .open = dai_list_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
-
-static int platform_list_seq_show(struct seq_file *m, void *v)
+static int platform_list_show(struct seq_file *m, void *v)
{
struct snd_soc_platform *platform;
@@ -416,18 +394,7 @@ static int platform_list_seq_show(struct seq_file *m, void *v)
return 0;
}
-
-static int platform_list_seq_open(struct inode *inode, struct file *file)
-{
- return single_open(file, platform_list_seq_show, NULL);
-}
-
-static const struct file_operations platform_list_fops = {
- .open = platform_list_seq_open,
- .read = seq_read,
- .llseek = seq_lseek,
- .release = single_release,
-};
+DEFINE_SHOW_ATTRIBUTE(platform_list);
static void soc_init_card_debugfs(struct snd_soc_card *card)
{