Re: [PATCH 1/2] ARM: dump: Convert to use DEFINE_SHOW_ATTRIBUTE macro
On Wed, Jun 13, 2018 at 9:15 AM Peng Donglin wrote: > > Use DEFINE_SHOW_ATTRIBUTE macro to simplify the code. > > Signed-off-by: Peng Donglin > --- > arch/arm/mm/ptdump_debugfs.c | 13 + > 1 file changed, 1 insertion(+), 12 deletions(-) > > diff --git a/arch/arm/mm/ptdump_debugfs.c b/arch/arm/mm/ptdump_debugfs.c > index be8d87b..79002fe 100644 > --- a/arch/arm/mm/ptdump_debugfs.c > +++ b/arch/arm/mm/ptdump_debugfs.c > @@ -11,18 +11,7 @@ static int ptdump_show(struct seq_file *m, void *v) > ptdump_walk_pgd(m, info); > return 0; > } > - > -static int ptdump_open(struct inode *inode, struct file *file) > -{ > - return single_open(file, ptdump_show, inode->i_private); > -} > - > -static const struct file_operations ptdump_fops = { > - .open = ptdump_open, > - .read = seq_read, > - .llseek = seq_lseek, > - .release= single_release, > -}; > +DEFINE_SHOW_ATTRIBUTE(ptdump); > > int ptdump_debugfs_register(struct ptdump_info *info, const char *name) > { > -- > 2.7.4 > any suggestion?
Re: [PATCH v4] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
On Wed, Feb 14, 2018 at 10:53 PM, Mark Brown 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.
Re: [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
On Wed, Feb 14, 2018 at 10:41 PM, Andy Shevchenko wrote: > On Wed, Feb 14, 2018 at 4:39 PM, Donglin Peng wrote: >> On Mon, Feb 12, 2018 at 7:49 PM, Mark Brown 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
Re: [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
On Mon, Feb 12, 2018 at 7:49 PM, Mark Brown 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.
Re: [PATCH v3] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
On Mon, Feb 12, 2018 at 3:49 AM, Mark Brown 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.
Re: [PATCH] seq_file: remove redundant assignment of index to m->index
On Sun, Feb 11, 2018 at 9:02 AM, Matthew Wilcox wrote: > On Sat, Feb 10, 2018 at 10:04:23AM -0800, Joe Perches wrote: >> > @@ -120,14 +120,12 @@ static int traverse(struct seq_file *m, loff_t >> > offset) >> > if (pos + m->count > offset) { >> > m->from = offset - pos; >> > m->count -= m->from; >> > -m->index = index; >> > break; >> > } >> > pos += m->count; >> > m->count = 0; >> > if (pos == offset) { >> > index++; >> > -m->index = index; >> > break; >> > } >> > p = m->op->next(m, p, &index); >> >> Of course this looks correct, but how >> are you _absolutely sure_ about this? >> >> Perhaps the m->op->stop(m, p) call below >> the break, which takes m as an argument, >> needs an updated m->index. > > Not only that, but ->next might also look at m->index. I think there is no chance to call op->next, because the loop will break immediately after the assignment.
[PATCH] seq_file: remove redundant assignment of index to m->index
There are two redundant assignments in the traverse() function, because the while loop will break after these two assignments, and after that the variable index will be assigned to m->index again. Signed-off-by: Peng Donglin --- fs/seq_file.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/seq_file.c b/fs/seq_file.c index eea09f6..2298656 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c @@ -120,14 +120,12 @@ static int traverse(struct seq_file *m, loff_t offset) if (pos + m->count > offset) { m->from = offset - pos; m->count -= m->from; -m->index = index; break; } pos += m->count; m->count = 0; if (pos == offset) { index++; -m->index = index; break; } p = m->op->next(m, p, &index); -- 1.9.1
[PATCH v3] 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 Reviewed-by: Andy Shevchenko --- 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
Re: [PATCH v2] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
On Fri, Feb 9, 2018 at 10:52 PM, Andy Shevchenko wrote: > On Fri, Feb 9, 2018 at 4:43 PM, Donglin Peng wrote: >> 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. >> > > You missed my tag. > > Reviewed-by: Andy Shevchenko Sorry, I got it.
Re: [PATCH v2] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
On Fri, Feb 9, 2018 at 10:52 PM, Andy Shevchenko wrote: > On Fri, Feb 9, 2018 at 4:43 PM, Donglin Peng wrote: >> 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. >> > > You missed my tag. > > Reviewed-by: Andy Shevchenko Like this: 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. Reviewed-by: Andy Shevchenko Signed-off-by: Peng Donglin
[PATCH v2] 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 --- 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
Re: [PATCH] ASoC: use DEFINE_SHOW_ATTRIBUTE() to decrease code duplication
On Fri, Feb 9, 2018 at 9:21 PM, Andy Shevchenko wrote: > On Fri, Feb 9, 2018 at 8:58 AM, Donglin Peng wrote: >> There is some duplicate code in soc-core.c,and the kernel provides > > 'core.c,and' -> 'core.c, and' > >> +static int codec_list_show(struct seq_file *s, void *v) > > No need to rename m -> s. > >> +static int dai_list_show(struct seq_file *s, void *v) > > Ditto. > >> +static int platform_list_show(struct seq_file *s, void *v) > > Ditto. > > After addressing above, > > Reviewed-by: Andy Shevchenko > > -- > With Best Regards, > Andy Shevchenko Thanks for review, and I will send a patch v2.
[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 --- sound/soc/soc-core.c | 51 +-- 1 file changed, 9 insertions(+), 42 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 96c44f6576c9..cb52d1e8e0b9 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -349,33 +349,22 @@ 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 *s, void *v) { struct snd_soc_codec *codec; mutex_lock(&client_mutex); list_for_each_entry(codec, &codec_list, list) -seq_printf(m, "%s\n", codec->component.name); +seq_printf(s, "%s\n", codec->component.name); mutex_unlock(&client_mutex); 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 *s, void *v) { struct snd_soc_component *component; struct snd_soc_dai *dai; @@ -384,50 +373,28 @@ static int dai_list_seq_show(struct seq_file *m, void *v) list_for_each_entry(component, &component_list, list) list_for_each_entry(dai, &component->dai_list, list) -seq_printf(m, "%s\n", dai->name); +seq_printf(s, "%s\n", dai->name); mutex_unlock(&client_mutex); 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 *s, void *v) { struct snd_soc_platform *platform; mutex_lock(&client_mutex); list_for_each_entry(platform, &platform_list, list) -seq_printf(m, "%s\n", platform->component.name); +seq_printf(s, "%s\n", platform->component.name); mutex_unlock(&client_mutex); 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
Re: [PATCH v2] ASoC: use seq_file to dump the contents of dai_list,platform_list and codec_list
Okay, I will send it later. On Thu, Feb 8, 2018 at 11:42 PM, Mark Brown wrote: > On Thu, Feb 08, 2018 at 04:25:10PM +0200, Andy Shevchenko wrote: >> On Fri, Jan 26, 2018 at 9:16 AM, Donglin Peng wrote: > >> > I can send another patch after the following patch is merged: >> > https://patchwork.kernel.org/patch/10178813/ > >> It's merged. I think whenever Mark switched his repositories for new >> cycle you may be able to submit a patch. > > Send it any time, I'll just not apply it until after -rc1 comes out.
Re: [PATCH v2] ASoC: use seq_file to dump the contents of dai_list,platform_list and codec_list
On Wed, Jan 24, 2018 at 1:37 AM, Mark Brown wrote: > On Tue, Jan 23, 2018 at 07:08:15PM +0200, Andy Shevchenko wrote: > >> If it's not critical, I would suggest to wait till v4.16-rc1, where I >> would like to push [1], and switch to DEFINE_SHOW_ATTRIBUTE() macro. > > Too late, I already applied this - a further conversion for the new > macro would be good. I can send another patch after the following patch is merged: https://patchwork.kernel.org/patch/10178813/
[PATCH v2] ASoC: use seq_file to dump the contents of dai_list,platform_list and codec_list
Now the debugfs files dais/platforms/codecs have a size limit PAGE_SIZE and the user can not see the whole contents of dai_list/platform_list/codec_list when they are larger than this limit. This patch uses seq_file instead to make sure dais/platforms/codecs show the full contents of dai_list/platform_list/codec_list. Signed-off-by: Donglin Peng --- Changelog v2 -fix commit log error sound/soc/soc-core.c | 111 +-- 1 file changed, 37 insertions(+), 74 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c0edac80df34..7b582112e3fc 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -349,120 +349,84 @@ static void soc_init_codec_debugfs(struct snd_soc_component *component) "ASoC: Failed to create codec register debugfs file\n"); } -static ssize_t codec_list_read_file(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) +static int codec_list_seq_show(struct seq_file *m, void *v) { - char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); - ssize_t len, ret = 0; struct snd_soc_codec *codec; - if (!buf) - return -ENOMEM; - mutex_lock(&client_mutex); - list_for_each_entry(codec, &codec_list, list) { - len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", - codec->component.name); - if (len >= 0) - ret += len; - if (ret > PAGE_SIZE) { - ret = PAGE_SIZE; - break; - } - } + list_for_each_entry(codec, &codec_list, list) + seq_printf(m, "%s\n", codec->component.name); mutex_unlock(&client_mutex); - if (ret >= 0) - ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); - - kfree(buf); + return 0; +} - return ret; +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 = { - .read = codec_list_read_file, - .llseek = default_llseek,/* read accesses f_pos */ + .open = codec_list_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; -static ssize_t dai_list_read_file(struct file *file, char __user *user_buf, - size_t count, loff_t *ppos) +static int dai_list_seq_show(struct seq_file *m, void *v) { - char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); - ssize_t len, ret = 0; struct snd_soc_component *component; struct snd_soc_dai *dai; - if (!buf) - return -ENOMEM; - mutex_lock(&client_mutex); - list_for_each_entry(component, &component_list, list) { - list_for_each_entry(dai, &component->dai_list, list) { - len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", - dai->name); - if (len >= 0) - ret += len; - if (ret > PAGE_SIZE) { - ret = PAGE_SIZE; - break; - } - } - } + list_for_each_entry(component, &component_list, list) + list_for_each_entry(dai, &component->dai_list, list) + seq_printf(m, "%s\n", dai->name); mutex_unlock(&client_mutex); - ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); - - kfree(buf); + return 0; +} - return ret; +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 = { - .read = dai_list_read_file, - .llseek = default_llseek,/* read accesses f_pos */ + .open = dai_list_seq_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release, }; -static ssize_t platform_list_read_file(struct file *file, - char __user *user_buf, - size_t count, loff_t *ppos) +static int platform_list_seq_show(struct seq_file *m, void *v) { - char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); - ssize_t len, ret = 0; struct snd_soc_platform *platform; - if (!buf) - return -ENOMEM; - mutex_lock(&client_mutex); - list_for_each_entry(platform, &platform_list, list) { - len = snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", - platform->component.name);
Re: [alsa-devel] [PATCH] ASoC: dapm: Fix typos in comment
Thanks, i see. On Wed, Sep 27, 2017 at 10:39 PM, Lars-Peter Clausen wrote: > On 09/27/2017 04:35 PM, Peng Donglin wrote: >> Signed-off-by: Peng Donglin >> --- >> sound/soc/soc-dapm.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c >> index dcef67a..0867eaa 100644 >> --- a/sound/soc/soc-dapm.c >> +++ b/sound/soc/soc-dapm.c >> @@ -4167,7 +4167,7 @@ void snd_soc_dapm_stream_event(struct >> snd_soc_pcm_runtime *rtd, int stream, >> * @dapm: DAPM context >> * @pin: pin name >> * >> - * Enables input/output pin and its parents or children widgets iff there is >> + * Enables input/output pin and its parents or children widgets if there is > > https://en.wikipedia.org/wiki/If_and_only_if
Re: [PATCH v2 03/10] ASoC: Intel: Remove unnecessary function call
Hi Mark, On Wed, Aug 23, 2017 at 8:19 PM, Peng Donglin wrote: > The work of the function platform_set_drvdata is done by > devm_snd_soc_register_card. > > Signed-off-by: Peng Donglin > --- > > Changes in v2: > -add missed occurrences. > > sound/soc/intel/boards/bytcht_da7213.c | 6 ++ > sound/soc/intel/boards/bytcht_es8316.c | 6 ++ > sound/soc/intel/boards/bytcht_nocodec.c | 6 ++ > sound/soc/intel/boards/bytcr_rt5640.c| 7 ++- > sound/soc/intel/boards/bytcr_rt5651.c| 7 ++- > sound/soc/intel/boards/cht_bsw_max98090_ti.c | 6 ++ > sound/soc/intel/boards/cht_bsw_rt5645.c | 6 ++ > sound/soc/intel/boards/cht_bsw_rt5672.c | 6 ++ > 8 files changed, 16 insertions(+), 34 deletions(-) > I found that this patch had not been applied, perhaps you missed it.
Re: [PATCH v2] ASoC: Add a sanity check before using dai driver name
On Sun, Aug 27, 2017 at 10:31 PM, Jeffy Chen wrote: > hi dong, > > thanks for noticing, but i think mark've applied the right version. > > this amazing robot would help to test all patches, not only the ones already > applied :) I also think so.
Re: [PATCH v2] ASoC: Add a sanity check before using dai driver name
Hi Jeffy, On Sun, Aug 27, 2017 at 8:19 PM, Mark Brown wrote: > On Sat, Aug 26, 2017 at 11:09:49PM +0800, Donglin Peng wrote: > >> It seems that the v3 patch should be applied other than v2. > > Please send incremental fixes rather than new versions for things that > are are already applied. You should send a incremental patch rather than v3 patch, because your v2 patch had been applied and caused this issue.
Re: [PATCH v2] ASoC: Add a sanity check before using dai driver name
Hi Mark, On Sat, Aug 26, 2017 at 10:13 PM, kbuild test robot wrote: > Hi Jeffy, > > [auto build test ERROR on asoc/for-next] > [also build test ERROR on next-20170825] > [cannot apply to v4.13-rc6] > [if your patch is applied to the wrong git tree, please drop us a note to > help improve the system] > > url: > https://github.com/0day-ci/linux/commits/Jeffy-Chen/ASoC-Add-a-sanity-check-before-using-dai-driver-name/20170826-195851 > base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git > for-next > config: x86_64-randconfig-it0-08261958 (attached as .config) > compiler: gcc-4.9 (Debian 4.9.4-2) 4.9.4 > reproduce: > # save the attached .config to linux build tree > make ARCH=x86_64 > > All error/warnings (new ones prefixed by >>): > >sound//soc/soc-core.c: In function 'snd_soc_find_dai': >>> sound//soc/soc-core.c:4321:0: error: unterminated argument list invoking >>> macro "if" > MODULE_ALIAS("platform:soc-audio"); > ^ >>> sound//soc/soc-core.c:1031:4: error: expected '(' at end of input >if (dlc->dai_name && strcmp(dai->name, dlc->dai_name) >^ It seems that the v3 patch should be applied other than v2.
Re: [PATCH v2] ASoC: Add a sanity check before using dai driver name
On Thu, Aug 24, 2017 at 11:34 AM, Jeffy Chen wrote: > list_for_each_entry(dai, &component->dai_list, list) { > if (dlc->dai_name && strcmp(dai->name, dlc->dai_name) > - && strcmp(dai->driver->name, dlc->dai_name)) > + && (!dai->driver->name > + || !strcmp(dai->driver->name, dlc->dai_name)) > continue; If the dai->driver->name is match with the dlc->dai_name, does it need to continue? > > return dai;
Re: [PATCH v5 2/9] ASoC: soc-core: Allow searching dai driver name in snd_soc_find_dai
On Tue, Aug 22, 2017 at 10:02 PM, Mark Brown wrote: > On Tue, Aug 22, 2017 at 09:24:32PM +0800, Donglin Peng wrote: > >> In case that dai->driver->name is NULL, strcmp(dai->driver->name, >> dlc->dai_name) will cause segmentation fault. >> so I think that we can change it as the follows: > > We should be already verifying that drivers have a name, we assume one > elsewhere. But I can't find any codes that set or check dai_driver->name in function snd_soc_register_codec or snd_soc_register_component.
Re: [PATCH v5 2/9] ASoC: soc-core: Allow searching dai driver name in snd_soc_find_dai
Hi jeffy, On Tue, Aug 22, 2017 at 3:57 PM, Jeffy Chen wrote: > @@ -978,7 +978,8 @@ struct snd_soc_dai *snd_soc_find_dai( > if (dlc->name && strcmp(component->name, dlc->name)) > continue; > list_for_each_entry(dai, &component->dai_list, list) { > - if (dlc->dai_name && strcmp(dai->name, dlc->dai_name)) > + if (dlc->dai_name && strcmp(dai->name, dlc->dai_name) > + && strcmp(dai->driver->name, dlc->dai_name)) In case that dai->driver->name is NULL, strcmp(dai->driver->name, dlc->dai_name) will cause segmentation fault. so I think that we can change it as the follows: if (dlc->dai_name && strcmp(dai->name, dlc->dai_name) && dai->driver->name && strcmp(dai->driver->name, dlc->dai_name)) > continue; > > return dai; > -- > 2.11.0 > >
Re: [PATCH v5 6/9] ASoC: rockchip: Parse dai links from dts
On Tue, Aug 22, 2017 at 3:57 PM, Jeffy Chen wrote: > Refactor rockchip_sound_probe, parse dai links from dts instead of > hard coding them. > > Signed-off-by: Jeffy Chen > Reviewed-by: Matthias Kaehlcke > Tested-by: Matthias Kaehlcke > --- > > Changes in v5: None > Changes in v4: None > Changes in v3: > Use compatible to match audio codecs > -- Suggested-by Matthias Kaehlcke > > Changes in v2: > Let rockchip,codec-names be a required property, because we plan to > add more supported codecs to the fixed dai link list in the driver. > > sound/soc/rockchip/rk3399_gru_sound.c | 139 > ++ > 1 file changed, 91 insertions(+), 48 deletions(-) > > diff --git a/sound/soc/rockchip/rk3399_gru_sound.c > b/sound/soc/rockchip/rk3399_gru_sound.c > index 9b7e28703bfb..d532336871d7 100644 > --- a/sound/soc/rockchip/rk3399_gru_sound.c > +++ b/sound/soc/rockchip/rk3399_gru_sound.c > @@ -235,14 +235,42 @@ static const struct snd_soc_ops > rockchip_sound_da7219_ops = { > .hw_params = rockchip_sound_da7219_hw_params, > }; > > +static struct snd_soc_card rockchip_sound_card = { > + .name = "rk3399-gru-sound", > + .owner = THIS_MODULE, > + .dapm_widgets = rockchip_dapm_widgets, > + .num_dapm_widgets = ARRAY_SIZE(rockchip_dapm_widgets), > + .dapm_routes = rockchip_dapm_routes, > + .num_dapm_routes = ARRAY_SIZE(rockchip_dapm_routes), > + .controls = rockchip_controls, > + .num_controls = ARRAY_SIZE(rockchip_controls), > +}; > + > enum { > + DAILINK_DA7219, > DAILINK_MAX98357A, > DAILINK_RT5514, > - DAILINK_DA7219, > DAILINK_RT5514_DSP, > }; > > -static struct snd_soc_dai_link rockchip_dailinks[] = { > +static const char * const dailink_compat[] = { > + [DAILINK_DA7219] = "dlg,da7219", > + [DAILINK_MAX98357A] = "maxim,max98357a", > + [DAILINK_RT5514] = "realtek,rt5514-i2c", > + [DAILINK_RT5514_DSP] = "realtek,rt5514-spi", > +}; > + > +static const struct snd_soc_dai_link rockchip_dais[] = { > + [DAILINK_DA7219] = { > + .name = "DA7219", > + .stream_name = "DA7219 PCM", > + .codec_dai_name = "da7219-hifi", > + .init = rockchip_sound_da7219_init, > + .ops = &rockchip_sound_da7219_ops, > + /* set da7219 as slave */ > + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | > + SND_SOC_DAIFMT_CBS_CFS, > + }, > [DAILINK_MAX98357A] = { > .name = "MAX98357A", > .stream_name = "MAX98357A PCM", > @@ -261,16 +289,6 @@ static struct snd_soc_dai_link rockchip_dailinks[] = { > .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | > SND_SOC_DAIFMT_CBS_CFS, > }, > - [DAILINK_DA7219] = { > - .name = "DA7219", > - .stream_name = "DA7219 PCM", > - .codec_dai_name = "da7219-hifi", > - .init = rockchip_sound_da7219_init, > - .ops = &rockchip_sound_da7219_ops, > - /* set da7219 as slave */ > - .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | > - SND_SOC_DAIFMT_CBS_CFS, > - }, > /* RT5514 DSP for voice wakeup via spi bus */ > [DAILINK_RT5514_DSP] = { > .name = "RT5514 DSP", > @@ -279,53 +297,78 @@ static struct snd_soc_dai_link rockchip_dailinks[] = { > }, > }; > > -static struct snd_soc_card rockchip_sound_card = { > - .name = "rk3399-gru-sound", > - .owner = THIS_MODULE, > - .dai_link = rockchip_dailinks, > - .num_links = ARRAY_SIZE(rockchip_dailinks), > - .dapm_widgets = rockchip_dapm_widgets, > - .num_dapm_widgets = ARRAY_SIZE(rockchip_dapm_widgets), > - .dapm_routes = rockchip_dapm_routes, > - .num_dapm_routes = ARRAY_SIZE(rockchip_dapm_routes), > - .controls = rockchip_controls, > - .num_controls = ARRAY_SIZE(rockchip_controls), > -}; > - > -static int rockchip_sound_probe(struct platform_device *pdev) > +static int rockchip_sound_codec_node_match(struct device_node *np_codec) > { > - struct snd_soc_card *card = &rockchip_sound_card; > - struct device_node *cpu_node; > - int i, ret; > + int i; > > - cpu_node = of_parse_phandle(pdev->dev.of_node, "rockchip,cpu", 0); > - if (!cpu_node) { > - dev_err(&pdev->dev, "Property 'rockchip,cpu' missing or > invalid\n"); > - return -EINVAL; > + for (i = 0; i < ARRAY_SIZE(dailink_compat); i++) { > + if (of_device_is_compatible(np_codec, dailink_compat[i])) > + return i; > } > + return -1; > +} > > - for (i = 0; i < ARRAY_SIZE(rockchip_dailinks); i++) { > - rockchip_dailinks[i].platform_of_node = cpu_node; > - rockchip_dailinks[i].cpu_of_node