All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
@ 2018-02-09 15:10 Donglin Peng
  2018-02-12 11:49 ` Mark Brown
  0 siblings, 1 reply; 7+ messages in thread
From: Donglin Peng @ 2018-02-09 15:10 UTC (permalink / raw)
  To: Andy Shevchenko, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai
  Cc: ALSA Development Mailing List, Linux Kernel Mailing List

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>
---
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 96c44f6576c9..f372f34d7702 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] 7+ messages in thread

* Re: [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
  2018-02-09 15:10 [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication Donglin Peng
@ 2018-02-12 11:49 ` Mark Brown
  2018-02-14  8:47   ` Donglin Peng
  2018-02-14 14:39   ` Donglin Peng
  0 siblings, 2 replies; 7+ messages in thread
From: Mark Brown @ 2018-02-12 11:49 UTC (permalink / raw)
  To: Donglin Peng
  Cc: Andy Shevchenko, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	ALSA Development Mailing List, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 391 bytes --]

On Fri, Feb 09, 2018 at 11:10:55PM +0800, Donglin Peng wrote:

> --- 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");

Your patch has been corrupted somewhere (probably in your mail client) -
there's word wrapping here.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
  2018-02-12 11:49 ` Mark Brown
@ 2018-02-14  8:47   ` Donglin Peng
  2018-02-14 14:39   ` Donglin Peng
  1 sibling, 0 replies; 7+ messages in thread
From: Donglin Peng @ 2018-02-14  8:47 UTC (permalink / raw)
  To: Mark Brown
  Cc: Andy Shevchenko, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	ALSA Development Mailing List, Linux Kernel Mailing List

On Mon, Feb 12, 2018 at 3:49 AM, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Feb 09, 2018 at 11:10:55PM +0800, Donglin Peng wrote:
>
>> --- 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");
>
> Your patch has been corrupted somewhere (probably in your mail client) -
> there's word wrapping here.
Sorry, I will check it.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
  2018-02-12 11:49 ` Mark Brown
  2018-02-14  8:47   ` Donglin Peng
@ 2018-02-14 14:39   ` Donglin Peng
  2018-02-14 14:41     ` Andy Shevchenko
  1 sibling, 1 reply; 7+ messages in thread
From: Donglin Peng @ 2018-02-14 14:39 UTC (permalink / raw)
  To: Mark Brown
  Cc: Andy Shevchenko, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	ALSA Development Mailing List, Linux Kernel Mailing List

On Mon, Feb 12, 2018 at 7:49 PM, Mark Brown <broonie@kernel.org> wrote:
> On Fri, Feb 09, 2018 at 11:10:55PM +0800, Donglin Peng wrote:
>
>> --- 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");
>
> Your patch has been corrupted somewhere (probably in your mail client) -
> there's word wrapping here.
Hi Mark, do you know the way to disable gmail word wrap in plain text mode?
I find that gmail will force to wrap word at 70 characters in plain text mode.

There is a connection error when I use git send-email to send the patch
because I am using VPN.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
  2018-02-14 14:39   ` Donglin Peng
@ 2018-02-14 14:41     ` Andy Shevchenko
  2018-02-14 14:52         ` Donglin Peng
  0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2018-02-14 14:41 UTC (permalink / raw)
  To: Donglin Peng
  Cc: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	ALSA Development Mailing List, Linux Kernel Mailing List

On Wed, Feb 14, 2018 at 4:39 PM, Donglin Peng <dolinux.peng@gmail.com> wrote:
> On Mon, Feb 12, 2018 at 7:49 PM, Mark Brown <broonie@kernel.org> wrote:
>> On Fri, Feb 09, 2018 at 11:10:55PM +0800, Donglin Peng wrote:

> Hi Mark, do you know the way to disable gmail word wrap in plain text mode?
> I find that gmail will force to wrap word at 70 characters in plain text mode.

> There is a connection error when I use git send-email to send the patch
> because I am using VPN.

You may use SMTPS port (587 IIRC?) of Gmail to send a patch via git send-email.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
  2018-02-14 14:41     ` Andy Shevchenko
@ 2018-02-14 14:52         ` Donglin Peng
  0 siblings, 0 replies; 7+ messages in thread
From: Donglin Peng @ 2018-02-14 14:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Mark Brown, Liam Girdwood, Jaroslav Kysela, Takashi Iwai,
	ALSA Development Mailing List, Linux Kernel Mailing List

On Wed, Feb 14, 2018 at 10:41 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Wed, Feb 14, 2018 at 4:39 PM, Donglin Peng <dolinux.peng@gmail.com> wrote:
>> On Mon, Feb 12, 2018 at 7:49 PM, Mark Brown <broonie@kernel.org> wrote:
>>> On Fri, Feb 09, 2018 at 11:10:55PM +0800, Donglin Peng wrote:
>
>> Hi Mark, do you know the way to disable gmail word wrap in plain text mode?
>> I find that gmail will force to wrap word at 70 characters in plain text mode.
>
>> There is a connection error when I use git send-email to send the patch
>> because I am using VPN.
>
> You may use SMTPS port (587 IIRC?) of Gmail to send a patch via git send-email.
Thanks, I have sent it just now.
>
> --
> With Best Regards,
> Andy Shevchenko

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
@ 2018-02-14 14:52         ` Donglin Peng
  0 siblings, 0 replies; 7+ messages in thread
From: Donglin Peng @ 2018-02-14 14:52 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: ALSA Development Mailing List, Liam Girdwood,
	Linux Kernel Mailing List, Takashi Iwai, Mark Brown

On Wed, Feb 14, 2018 at 10:41 PM, Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Wed, Feb 14, 2018 at 4:39 PM, Donglin Peng <dolinux.peng@gmail.com> wrote:
>> On Mon, Feb 12, 2018 at 7:49 PM, Mark Brown <broonie@kernel.org> wrote:
>>> On Fri, Feb 09, 2018 at 11:10:55PM +0800, Donglin Peng wrote:
>
>> Hi Mark, do you know the way to disable gmail word wrap in plain text mode?
>> I find that gmail will force to wrap word at 70 characters in plain text mode.
>
>> There is a connection error when I use git send-email to send the patch
>> because I am using VPN.
>
> You may use SMTPS port (587 IIRC?) of Gmail to send a patch via git send-email.
Thanks, I have sent it just now.
>
> --
> With Best Regards,
> Andy Shevchenko

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-02-14 14:53 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-09 15:10 [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication Donglin Peng
2018-02-12 11:49 ` Mark Brown
2018-02-14  8:47   ` Donglin Peng
2018-02-14 14:39   ` Donglin Peng
2018-02-14 14:41     ` Andy Shevchenko
2018-02-14 14:52       ` Donglin Peng
2018-02-14 14:52         ` Donglin Peng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.