From 6b49087912e311bc884d36874592595508630b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Hundeb=C3=B8ll?= Date: Thu, 1 Feb 2018 11:09:41 +0100 Subject: [PATCH 1/4] ASoC: soc-core: remove error due to probe deferral MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Deferred probes shouldn't cause error messages in the boot log, so change the dev_err() to the more harmless dev_info(). Signed-off-by: Martin Hundebøll Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 96c44f6576c9..60a542f35dbd 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1100,8 +1100,8 @@ static int soc_bind_dai_link(struct snd_soc_card *card, cpu_dai_component.dai_name = dai_link->cpu_dai_name; rtd->cpu_dai = snd_soc_find_dai(&cpu_dai_component); if (!rtd->cpu_dai) { - dev_err(card->dev, "ASoC: CPU DAI %s not registered\n", - dai_link->cpu_dai_name); + dev_info(card->dev, "ASoC: CPU DAI %s not registered\n", + dai_link->cpu_dai_name); goto _err_defer; } snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component); From 7a2ccad58106696b7909815cc7ab359ae2743bcc Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Wed, 14 Feb 2018 02:58:03 +0000 Subject: [PATCH 2/4] ASoC: soc-core: soc_probe_dai() code simplification Current soc_probe_dai() is using deep nested condition. Thus, it is difficult to read/understand. This patch simplification it. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 60a542f35dbd..574048a73b1c 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1624,22 +1624,21 @@ static int soc_probe_link_components(struct snd_soc_card *card, static int soc_probe_dai(struct snd_soc_dai *dai, int order) { - int ret; + if (dai->probed || + dai->driver->probe_order != order) + return 0; - if (!dai->probed && dai->driver->probe_order == order) { - if (dai->driver->probe) { - ret = dai->driver->probe(dai); - if (ret < 0) { - dev_err(dai->dev, - "ASoC: failed to probe DAI %s: %d\n", - dai->name, ret); - return ret; - } + if (dai->driver->probe) { + int ret = dai->driver->probe(dai); + if (ret < 0) { + dev_err(dai->dev, "ASoC: failed to probe DAI %s: %d\n", + dai->name, ret); + return ret; } - - dai->probed = 1; } + dai->probed = 1; + return 0; } From c15b2a1d185bcdab6556492b81b55ba9e658e201 Mon Sep 17 00:00:00 2001 From: Peng Donglin Date: Wed, 14 Feb 2018 22:48:07 +0800 Subject: [PATCH 3/4] 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 Signed-off-by: Mark Brown --- 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 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) { From f7e73b26aea58003931e2f3925d9c01f6b6c4c4d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Fri, 9 Mar 2018 12:46:27 +0000 Subject: [PATCH 4/4] ASoC: core: Fix typo roup->group Signed-off-by: Mark Brown --- sound/soc/soc-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index e1f047de599e..4cd32f1bceb4 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -221,14 +221,14 @@ static const struct attribute_group soc_dapm_dev_group = { .is_visible = soc_dev_attr_is_visible, }; -static const struct attribute_group soc_dev_roup = { +static const struct attribute_group soc_dev_group = { .attrs = soc_dev_attrs, .is_visible = soc_dev_attr_is_visible, }; static const struct attribute_group *soc_dev_attr_groups[] = { &soc_dapm_dev_group, - &soc_dev_roup, + &soc_dev_group, NULL };