[alsa-devel] [PATCH 0/7] ASoC: soc-pcm: add soc_rtd_xxx()
Hi Mark
My ALSA SoC cleanup series focus to soc-pcm as 2nd step :) These create new soc_rtd_xxx() function, and cleanup soc-pcm.c (It will be more cleanup later)
Kuninori Morimoto (7): ASoC: soc-pcm: add soc_rtd_startup() ASoC: soc-pcm: add soc_rtd_shutdown() ASoC: soc-pcm: add soc_rtd_prepare() ASoC: soc-pcm: add soc_rtd_hw_params() ASoC: soc-pcm: add soc_rtd_hw_free() ASoC: soc-pcm: add soc_rtd_trigger() ASoC: soc-core: remove null_snd_soc_ops
sound/soc/soc-core.c | 4 -- sound/soc/soc-pcm.c | 118 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 79 insertions(+), 43 deletions(-)
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Add soc_rtd_startup() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-pcm.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 74d340d..c001829 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -28,6 +28,15 @@
#define DPCM_MAX_BE_USERS 8
+static int soc_rtd_startup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->startup) + return rtd->dai_link->ops->startup(substream); + return 0; +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -522,13 +531,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) codec_dai->rx_mask = 0; }
- if (rtd->dai_link->ops->startup) { - ret = rtd->dai_link->ops->startup(substream); - if (ret < 0) { - pr_err("ASoC: %s startup failed: %d\n", - rtd->dai_link->name, ret); - goto machine_err; - } + ret = soc_rtd_startup(rtd, substream); + if (ret < 0) { + pr_err("ASoC: %s startup failed: %d\n", + rtd->dai_link->name, ret); + goto machine_err; }
/* Dynamic PCM DAI links compat checks use dynamic capabilities */
The patch
ASoC: soc-pcm: add soc_rtd_startup()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 f183f9277a0f16e340bbcb28bf30834652ef10e1 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Wed, 22 Jan 2020 09:44:35 +0900 Subject: [PATCH] ASoC: soc-pcm: add soc_rtd_startup()
Add soc_rtd_startup() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/878sm0mia4.wl-kuninori.morimoto.gx@renesas.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-pcm.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 74d340d1c9f7..c0018293c67b 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -28,6 +28,15 @@
#define DPCM_MAX_BE_USERS 8
+static int soc_rtd_startup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->startup) + return rtd->dai_link->ops->startup(substream); + return 0; +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -522,13 +531,11 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) codec_dai->rx_mask = 0; }
- if (rtd->dai_link->ops->startup) { - ret = rtd->dai_link->ops->startup(substream); - if (ret < 0) { - pr_err("ASoC: %s startup failed: %d\n", - rtd->dai_link->name, ret); - goto machine_err; - } + ret = soc_rtd_startup(rtd, substream); + if (ret < 0) { + pr_err("ASoC: %s startup failed: %d\n", + rtd->dai_link->name, ret); + goto machine_err; }
/* Dynamic PCM DAI links compat checks use dynamic capabilities */
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Add soc_rtd_shutdown() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-pcm.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index c001829..8095c64 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -37,6 +37,14 @@ static int soc_rtd_startup(struct snd_soc_pcm_runtime *rtd, return 0; }
+static void soc_rtd_shutdown(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->shutdown) + rtd->dai_link->ops->shutdown(substream); +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -602,8 +610,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) return 0;
config_err: - if (rtd->dai_link->ops->shutdown) - rtd->dai_link->ops->shutdown(substream); + soc_rtd_shutdown(rtd, substream);
machine_err: i = rtd->num_codecs; @@ -674,8 +681,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) for_each_rtd_codec_dai(rtd, i, codec_dai) snd_soc_dai_shutdown(codec_dai, substream);
- if (rtd->dai_link->ops->shutdown) - rtd->dai_link->ops->shutdown(substream); + soc_rtd_shutdown(rtd, substream);
soc_pcm_components_close(substream, NULL);
The patch
ASoC: soc-pcm: add soc_rtd_shutdown()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 0be429f9fcfccfbbbcdb40e154a5c2328da17ca9 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Wed, 22 Jan 2020 09:44:40 +0900 Subject: [PATCH] ASoC: soc-pcm: add soc_rtd_shutdown()
Add soc_rtd_shutdown() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/877e1kmi9z.wl-kuninori.morimoto.gx@renesas.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-pcm.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index c0018293c67b..8095c64c4e3e 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -37,6 +37,14 @@ static int soc_rtd_startup(struct snd_soc_pcm_runtime *rtd, return 0; }
+static void soc_rtd_shutdown(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->shutdown) + rtd->dai_link->ops->shutdown(substream); +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -602,8 +610,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) return 0;
config_err: - if (rtd->dai_link->ops->shutdown) - rtd->dai_link->ops->shutdown(substream); + soc_rtd_shutdown(rtd, substream);
machine_err: i = rtd->num_codecs; @@ -674,8 +681,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) for_each_rtd_codec_dai(rtd, i, codec_dai) snd_soc_dai_shutdown(codec_dai, substream);
- if (rtd->dai_link->ops->shutdown) - rtd->dai_link->ops->shutdown(substream); + soc_rtd_shutdown(rtd, substream);
soc_pcm_components_close(substream, NULL);
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Add soc_rtd_prepare() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-pcm.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 8095c64..ccd6c9c 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -45,6 +45,15 @@ static void soc_rtd_shutdown(struct snd_soc_pcm_runtime *rtd, rtd->dai_link->ops->shutdown(substream); }
+static int soc_rtd_prepare(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->prepare) + return rtd->dai_link->ops->prepare(substream); + return 0; +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -716,13 +725,11 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
- if (rtd->dai_link->ops->prepare) { - ret = rtd->dai_link->ops->prepare(substream); - if (ret < 0) { - dev_err(rtd->card->dev, "ASoC: machine prepare error:" - " %d\n", ret); - goto out; - } + ret = soc_rtd_prepare(rtd, substream); + if (ret < 0) { + dev_err(rtd->card->dev, + "ASoC: machine prepare error: %d\n", ret); + goto out; }
for_each_rtd_components(rtd, i, component) {
The patch
ASoC: soc-pcm: add soc_rtd_prepare()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 44c1a75b0d889b3a5faff9edc837d972806bb46a Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Wed, 22 Jan 2020 09:44:44 +0900 Subject: [PATCH] ASoC: soc-pcm: add soc_rtd_prepare()
Add soc_rtd_prepare() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/875zh4mi9v.wl-kuninori.morimoto.gx@renesas.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-pcm.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 8095c64c4e3e..ccd6c9ca55ab 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -45,6 +45,15 @@ static void soc_rtd_shutdown(struct snd_soc_pcm_runtime *rtd, rtd->dai_link->ops->shutdown(substream); }
+static int soc_rtd_prepare(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->prepare) + return rtd->dai_link->ops->prepare(substream); + return 0; +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -716,13 +725,11 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
- if (rtd->dai_link->ops->prepare) { - ret = rtd->dai_link->ops->prepare(substream); - if (ret < 0) { - dev_err(rtd->card->dev, "ASoC: machine prepare error:" - " %d\n", ret); - goto out; - } + ret = soc_rtd_prepare(rtd, substream); + if (ret < 0) { + dev_err(rtd->card->dev, + "ASoC: machine prepare error: %d\n", ret); + goto out; }
for_each_rtd_components(rtd, i, component) {
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Add soc_rtd_hw_params() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-pcm.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index ccd6c9c..d7fc6c5 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -54,6 +54,16 @@ static int soc_rtd_prepare(struct snd_soc_pcm_runtime *rtd, return 0; }
+static int soc_rtd_hw_params(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->hw_params) + return rtd->dai_link->ops->hw_params(substream, params); + return 0; +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -826,13 +836,11 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, if (ret) goto out;
- if (rtd->dai_link->ops->hw_params) { - ret = rtd->dai_link->ops->hw_params(substream, params); - if (ret < 0) { - dev_err(rtd->card->dev, "ASoC: machine hw_params" - " failed: %d\n", ret); - goto out; - } + ret = soc_rtd_hw_params(rtd, substream, params); + if (ret < 0) { + dev_err(rtd->card->dev, + "ASoC: machine hw_params failed: %d\n", ret); + goto out; }
for_each_rtd_codec_dai(rtd, i, codec_dai) {
The patch
ASoC: soc-pcm: add soc_rtd_hw_params()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 de9ad990284f16a435675e4e73c7ffaaea9ee4b2 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Wed, 22 Jan 2020 09:44:48 +0900 Subject: [PATCH] ASoC: soc-pcm: add soc_rtd_hw_params()
Add soc_rtd_hw_params() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/874kwomi9r.wl-kuninori.morimoto.gx@renesas.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-pcm.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index ccd6c9ca55ab..d7fc6c5d7906 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -54,6 +54,16 @@ static int soc_rtd_prepare(struct snd_soc_pcm_runtime *rtd, return 0; }
+static int soc_rtd_hw_params(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->hw_params) + return rtd->dai_link->ops->hw_params(substream, params); + return 0; +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -826,13 +836,11 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, if (ret) goto out;
- if (rtd->dai_link->ops->hw_params) { - ret = rtd->dai_link->ops->hw_params(substream, params); - if (ret < 0) { - dev_err(rtd->card->dev, "ASoC: machine hw_params" - " failed: %d\n", ret); - goto out; - } + ret = soc_rtd_hw_params(rtd, substream, params); + if (ret < 0) { + dev_err(rtd->card->dev, + "ASoC: machine hw_params failed: %d\n", ret); + goto out; }
for_each_rtd_codec_dai(rtd, i, codec_dai) {
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Add soc_rtd_hw_free() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-pcm.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index d7fc6c5..718749f 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -64,6 +64,14 @@ static int soc_rtd_hw_params(struct snd_soc_pcm_runtime *rtd, return 0; }
+static void soc_rtd_hw_free(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->hw_free) + rtd->dai_link->ops->hw_free(substream); +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -935,8 +943,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, codec_dai->rate = 0; }
- if (rtd->dai_link->ops->hw_free) - rtd->dai_link->ops->hw_free(substream); + soc_rtd_hw_free(rtd, substream);
mutex_unlock(&rtd->card->pcm_mutex); return ret; @@ -979,8 +986,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) }
/* free any machine hw params */ - if (rtd->dai_link->ops->hw_free) - rtd->dai_link->ops->hw_free(substream); + soc_rtd_hw_free(rtd, substream);
/* free any component resources */ soc_pcm_components_hw_free(substream, NULL);
The patch
ASoC: soc-pcm: add soc_rtd_hw_free()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 49f020e5714d2c48c8ed9a89169ef6a058e54c2f Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Wed, 22 Jan 2020 09:44:52 +0900 Subject: [PATCH] ASoC: soc-pcm: add soc_rtd_hw_free()
Add soc_rtd_hw_free() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/8736c8mi9n.wl-kuninori.morimoto.gx@renesas.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-pcm.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index d7fc6c5d7906..718749f12979 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -64,6 +64,14 @@ static int soc_rtd_hw_params(struct snd_soc_pcm_runtime *rtd, return 0; }
+static void soc_rtd_hw_free(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->hw_free) + rtd->dai_link->ops->hw_free(substream); +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -935,8 +943,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, codec_dai->rate = 0; }
- if (rtd->dai_link->ops->hw_free) - rtd->dai_link->ops->hw_free(substream); + soc_rtd_hw_free(rtd, substream);
mutex_unlock(&rtd->card->pcm_mutex); return ret; @@ -979,8 +986,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) }
/* free any machine hw params */ - if (rtd->dai_link->ops->hw_free) - rtd->dai_link->ops->hw_free(substream); + soc_rtd_hw_free(rtd, substream);
/* free any component resources */ soc_pcm_components_hw_free(substream, NULL);
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Add soc_rtd_trigger() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-pcm.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 718749f..e66ac9c 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -72,6 +72,16 @@ static void soc_rtd_hw_free(struct snd_soc_pcm_runtime *rtd, rtd->dai_link->ops->hw_free(substream); }
+static int soc_rtd_trigger(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream, + int cmd) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->trigger) + return rtd->dai_link->ops->trigger(substream, cmd); + return 0; +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -1013,11 +1023,9 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd) struct snd_soc_dai *codec_dai; int i, ret;
- if (rtd->dai_link->ops->trigger) { - ret = rtd->dai_link->ops->trigger(substream, cmd); - if (ret < 0) - return ret; - } + ret = soc_rtd_trigger(rtd, substream, cmd); + if (ret < 0) + return ret;
for_each_rtd_components(rtd, i, component) { ret = snd_soc_component_trigger(component, substream, cmd); @@ -1062,11 +1070,9 @@ static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd) return ret; }
- if (rtd->dai_link->ops->trigger) { - ret = rtd->dai_link->ops->trigger(substream, cmd); - if (ret < 0) - return ret; - } + ret = soc_rtd_trigger(rtd, substream, cmd); + if (ret < 0) + return ret;
return 0; }
The patch
ASoC: soc-pcm: add soc_rtd_trigger()
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 ad2bf9f252d667b385df606b4b762c26151bee78 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Wed, 22 Jan 2020 09:44:56 +0900 Subject: [PATCH] ASoC: soc-pcm: add soc_rtd_trigger()
Add soc_rtd_trigger() to make the code easier to read
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/871rrsmi9j.wl-kuninori.morimoto.gx@renesas.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-pcm.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 718749f12979..e66ac9ce321b 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -72,6 +72,16 @@ static void soc_rtd_hw_free(struct snd_soc_pcm_runtime *rtd, rtd->dai_link->ops->hw_free(substream); }
+static int soc_rtd_trigger(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream, + int cmd) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->trigger) + return rtd->dai_link->ops->trigger(substream, cmd); + return 0; +} + /** * snd_soc_runtime_activate() - Increment active count for PCM runtime components * @rtd: ASoC PCM runtime that is activated @@ -1013,11 +1023,9 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd) struct snd_soc_dai *codec_dai; int i, ret;
- if (rtd->dai_link->ops->trigger) { - ret = rtd->dai_link->ops->trigger(substream, cmd); - if (ret < 0) - return ret; - } + ret = soc_rtd_trigger(rtd, substream, cmd); + if (ret < 0) + return ret;
for_each_rtd_components(rtd, i, component) { ret = snd_soc_component_trigger(component, substream, cmd); @@ -1062,11 +1070,9 @@ static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd) return ret; }
- if (rtd->dai_link->ops->trigger) { - ret = rtd->dai_link->ops->trigger(substream, cmd); - if (ret < 0) - return ret; - } + ret = soc_rtd_trigger(rtd, substream, cmd); + if (ret < 0) + return ret;
return 0; }
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
All rtd->dai_link callback functions are controlled by soc_rtd_xxxx(), and checking rtd->dai_link->ops. We don't need to have null_snd_soc_ops anymore. This patch removes it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/soc-core.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index f969a3b..068d809 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -342,8 +342,6 @@ struct snd_soc_component *snd_soc_lookup_component(struct device *dev, } EXPORT_SYMBOL_GPL(snd_soc_lookup_component);
-static const struct snd_soc_ops null_snd_soc_ops; - struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) @@ -488,8 +486,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( */ rtd->card = card; rtd->dai_link = dai_link; - if (!rtd->dai_link->ops) - rtd->dai_link->ops = &null_snd_soc_ops;
/* see for_each_card_rtds */ list_add_tail(&rtd->list, &card->rtd_list);
The patch
ASoC: soc-core: remove null_snd_soc_ops
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.6
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 d8e2e0d2491e78f3f7b451c3a93ba29950efe2cf Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Wed, 22 Jan 2020 09:45:00 +0900 Subject: [PATCH] ASoC: soc-core: remove null_snd_soc_ops
All rtd->dai_link callback functions are controlled by soc_rtd_xxxx(), and checking rtd->dai_link->ops. We don't need to have null_snd_soc_ops anymore. This patch removes it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/87zhegl3oz.wl-kuninori.morimoto.gx@renesas.com Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/soc-core.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index f969a3b8c82b..068d809c349a 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -342,8 +342,6 @@ struct snd_soc_component *snd_soc_lookup_component(struct device *dev, } EXPORT_SYMBOL_GPL(snd_soc_lookup_component);
-static const struct snd_soc_ops null_snd_soc_ops; - struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link) @@ -488,8 +486,6 @@ static struct snd_soc_pcm_runtime *soc_new_pcm_runtime( */ rtd->card = card; rtd->dai_link = dai_link; - if (!rtd->dai_link->ops) - rtd->dai_link->ops = &null_snd_soc_ops;
/* see for_each_card_rtds */ list_add_tail(&rtd->list, &card->rtd_list);
On Tue, Jan 21, 2020 at 4:46 PM Kuninori Morimoto < kuninori.morimoto.gx@renesas.com> wrote:
Hi Mark
My ALSA SoC cleanup series focus to soc-pcm as 2nd step :) These create new soc_rtd_xxx() function, and cleanup soc-pcm.c (It will be more cleanup later)
Kuninori Morimoto (7): ASoC: soc-pcm: add soc_rtd_startup() ASoC: soc-pcm: add soc_rtd_shutdown() ASoC: soc-pcm: add soc_rtd_prepare() ASoC: soc-pcm: add soc_rtd_hw_params() ASoC: soc-pcm: add soc_rtd_hw_free() ASoC: soc-pcm: add soc_rtd_trigger() ASoC: soc-core: remove null_snd_soc_ops
The series looks good. Thanks, Morimoto-san.
Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com
My ALSA SoC cleanup series focus to soc-pcm as 2nd step :) These create new soc_rtd_xxx() function, and cleanup soc-pcm.c (It will be more cleanup later)
Kuninori Morimoto (7): ASoC: soc-pcm: add soc_rtd_startup() ASoC: soc-pcm: add soc_rtd_shutdown() ASoC: soc-pcm: add soc_rtd_prepare() ASoC: soc-pcm: add soc_rtd_hw_params() ASoC: soc-pcm: add soc_rtd_hw_free() ASoC: soc-pcm: add soc_rtd_trigger() ASoC: soc-core: remove null_snd_soc_ops
The series looks good. Thanks, Morimoto-san.
Reviewed-by: Ranjani Sridharan ranjani.sridharan@linux.intel.com
LGTM as well.
Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com
participants (4)
-
Kuninori Morimoto
-
Mark Brown
-
Pierre-Louis Bossart
-
Sridharan, Ranjani