* [PATCH] ASoC: intel: sof_sdw: add .exit callback function
@ 2020-08-20 13:45 Bard Liao
2020-08-21 16:39 ` Mark Brown
0 siblings, 1 reply; 2+ messages in thread
From: Bard Liao @ 2020-08-20 13:45 UTC (permalink / raw)
To: broonie, tiwai; +Cc: vkoul, alsa-devel, pierre-louis.bossart, bard.liao
We may allocate some resources in sof_sdw_codec_info .init function.
Adding a corresponding .exit function can help to release these resources.
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
sound/soc/intel/boards/sof_sdw.c | 31 +++++++++++++++++++++++++
sound/soc/intel/boards/sof_sdw_common.h | 1 +
2 files changed, 32 insertions(+)
diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index 2463d432bf4d..4bc1ed757009 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -1032,12 +1032,43 @@ static int mc_probe(struct platform_device *pdev)
return ret;
}
+static int mc_remove(struct platform_device *pdev)
+{
+ struct snd_soc_card *card = platform_get_drvdata(pdev);
+ struct snd_soc_dai_link *link;
+ int ret;
+ int i, j;
+
+ for (i = 0; i < ARRAY_SIZE(codec_info_list); i++) {
+ if (!codec_info_list[i].exit)
+ continue;
+ /*
+ * We don't need to call .exit function if there is no matched
+ * dai link found.
+ */
+ for_each_card_prelinks(card, j, link) {
+ if (!strcmp(link->codecs[0].dai_name,
+ codec_info_list[i].dai_name)) {
+ ret = codec_info_list[i].exit(&pdev->dev, link);
+ if (ret)
+ dev_warn(&pdev->dev,
+ "codec exit failed %d\n",
+ ret);
+ break;
+ }
+ }
+ }
+
+ return 0;
+}
+
static struct platform_driver sof_sdw_driver = {
.driver = {
.name = "sof_sdw",
.pm = &snd_soc_pm_ops,
},
.probe = mc_probe,
+ .remove = mc_remove,
};
module_platform_driver(sof_sdw_driver);
diff --git a/sound/soc/intel/boards/sof_sdw_common.h b/sound/soc/intel/boards/sof_sdw_common.h
index 12e32439ba46..76d6c0c3839d 100644
--- a/sound/soc/intel/boards/sof_sdw_common.h
+++ b/sound/soc/intel/boards/sof_sdw_common.h
@@ -63,6 +63,7 @@ struct sof_sdw_codec_info {
struct sof_sdw_codec_info *info,
bool playback);
+ int (*exit)(struct device *dev, struct snd_soc_dai_link *dai_link);
bool late_probe;
int (*codec_card_late_probe)(struct snd_soc_card *card);
};
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: intel: sof_sdw: add .exit callback function
2020-08-20 13:45 [PATCH] ASoC: intel: sof_sdw: add .exit callback function Bard Liao
@ 2020-08-21 16:39 ` Mark Brown
0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2020-08-21 16:39 UTC (permalink / raw)
To: tiwai, Bard Liao; +Cc: vkoul, alsa-devel, pierre-louis.bossart, bard.liao
On Thu, 20 Aug 2020 21:45:42 +0800, Bard Liao wrote:
> We may allocate some resources in sof_sdw_codec_info .init function.
> Adding a corresponding .exit function can help to release these resources.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: intel: sof_sdw: add .exit callback function
commit: 751365035b4f360369ed6b0990283fd25d4ee32c
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-21 16:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 13:45 [PATCH] ASoC: intel: sof_sdw: add .exit callback function Bard Liao
2020-08-21 16:39 ` Mark Brown
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.