-
Notifications
You must be signed in to change notification settings - Fork 140
Fix free topology #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix free topology #340
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1824,6 +1824,12 @@ static int sof_dai_unload(struct snd_soc_component *scomp, | |
| { | ||
| struct snd_sof_pcm *spcm = dobj->private; | ||
|
|
||
| if (spcm->pcm.playback) | ||
| snd_dma_free_pages(&spcm->stream[SNDRV_PCM_STREAM_PLAYBACK].page_table); | ||
|
|
||
| if (spcm->pcm.capture) | ||
| snd_dma_free_pages(&spcm->stream[SNDRV_PCM_STREAM_CAPTURE].page_table); | ||
|
|
||
| list_del(&spcm->list); | ||
| kfree(spcm); | ||
|
|
||
|
|
@@ -2629,8 +2635,6 @@ EXPORT_SYMBOL(snd_sof_load_topology); | |
|
|
||
| void snd_sof_free_topology(struct snd_sof_dev *sdev) | ||
| { | ||
| struct snd_soc_dapm_context *dapm = | ||
| snd_soc_component_get_dapm(sdev->component); | ||
| struct snd_sof_route *sroute, *temp; | ||
plbossart marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| int ret; | ||
|
|
||
|
|
@@ -2645,11 +2649,5 @@ void snd_sof_free_topology(struct snd_sof_dev *sdev) | |
| kfree(sroute->private); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am also thinking should we add |
||
| kfree(sroute); | ||
| } | ||
|
|
||
| ret = snd_soc_tplg_component_remove(sdev->component, | ||
| SND_SOC_TPLG_INDEX_ALL); | ||
| if (ret < 0) | ||
| dev_err(sdev->dev, | ||
| "error: tplg component free failed %d\n", ret); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have mixed feelings about this. |
||
| } | ||
| EXPORT_SYMBOL(snd_sof_free_topology); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we keep
sof_pcm_free? Please see cbdc405. We still need to callsnd_pcm_lib_preallocate_free_for_allinsof_pcm_freeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's ugly to allocate dma pages in pcm_new and release them in dai_unload.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or let's allocate everything in dai_load, but not do a half-baked job in two places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bardliao doesnt snd_pcm_free() already call this? Do we need to call it again in sof_pcm_free?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ranj063 You are right. We don't need to call it in our driver. @plbossart I believe that we don't need snd_pcm_lib_preallocate_free_for_all() see https://patchwork.kernel.org/patch/6854731/
I vote for allocating everything in dai_load.