* [PATCH v4] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
@ 2018-02-14 14:48 Peng Donglin
2018-02-14 14:53 ` Mark Brown
2018-02-14 15:19 ` Applied "ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication" to the asoc tree Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Peng Donglin @ 2018-02-14 14:48 UTC (permalink / raw)
To: lgirdwood, broonie, perex, tiwai, andy.shevchenko
Cc: alsa-devel, linux-kernel, Peng Donglin
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>
---
v4:
* resend patch using outlook email, because I can't disable gmail
word wrap in plain text mode
v3: [addressed comments from Andy]
* add missing tag
v2: [addressed comments from Andy]
* modify code change description
* do not rename m -> s
---
sound/soc/soc-core.c | 45 ++++++---------------------------------------
1 file changed, 6 insertions(+), 39 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 96c44f6..f372f34 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)
{
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v4] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
2018-02-14 14:48 [PATCH v4] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication Peng Donglin
@ 2018-02-14 14:53 ` Mark Brown
2018-02-14 15:06 ` Donglin Peng
2018-02-14 15:19 ` Applied "ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication" to the asoc tree Mark Brown
1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2018-02-14 14:53 UTC (permalink / raw)
To: Peng Donglin
Cc: lgirdwood, perex, tiwai, andy.shevchenko, alsa-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 226 bytes --]
On Wed, Feb 14, 2018 at 10:48:07PM +0800, Peng Donglin wrote:
> v4:
> * resend patch using outlook email, because I can't disable gmail
> word wrap in plain text mode
Using Outlook for better interaction with the lists!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
2018-02-14 14:53 ` Mark Brown
@ 2018-02-14 15:06 ` Donglin Peng
0 siblings, 0 replies; 4+ messages in thread
From: Donglin Peng @ 2018-02-14 15:06 UTC (permalink / raw)
To: Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Andy Shevchenko,
ALSA Development Mailing List, Linux Kernel Mailing List
On Wed, Feb 14, 2018 at 10:53 PM, Mark Brown <broonie@kernel.org> wrote:
> On Wed, Feb 14, 2018 at 10:48:07PM +0800, Peng Donglin wrote:
>
>> v4:
>> * resend patch using outlook email, because I can't disable gmail
>> word wrap in plain text mode
>
> Using Outlook for better interaction with the lists!
Okay, I have sent it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Applied "ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication" to the asoc tree
2018-02-14 14:48 [PATCH v4] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication Peng Donglin
2018-02-14 14:53 ` Mark Brown
@ 2018-02-14 15:19 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2018-02-14 15:19 UTC (permalink / raw)
To: Peng Donglin
Cc: Mark Brown, lgirdwood, broonie, perex, tiwai, andy.shevchenko,
alsa-devel, linux-kernel, alsa-devel
The patch
ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
>From 658829d5f40f764d708e544dd85061ef3c3110fd Mon Sep 17 00:00:00 2001
From: Peng Donglin <dolinux.peng@gmail.com>
Date: Wed, 14 Feb 2018 22:48:07 +0800
Subject: [PATCH] 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>
---
sound/soc/soc-core.c | 45 ++++++---------------------------------------
1 file changed, 6 insertions(+), 39 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b928c59ea775..a2c9aa473324 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)
{
--
2.16.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-02-14 15:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-14 14:48 [PATCH v4] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication Peng Donglin
2018-02-14 14:53 ` Mark Brown
2018-02-14 15:06 ` Donglin Peng
2018-02-14 15:19 ` Applied "ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication" to the asoc tree Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).