Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/sound/soc-component.h
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,6 @@ struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
struct vm_area_struct *vma);
int snd_soc_pcm_component_new(struct snd_pcm *pcm);
void snd_soc_pcm_component_free(struct snd_pcm *pcm);
void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd);

#endif /* __SOC_COMPONENT_H */
5 changes: 2 additions & 3 deletions sound/soc/soc-component.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,13 +516,12 @@ int snd_soc_pcm_component_new(struct snd_pcm *pcm)
return 0;
}

void snd_soc_pcm_component_free(struct snd_pcm *pcm)
void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_pcm_runtime *rtd = pcm->private_data;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component;

for_each_rtd_components(rtd, rtdcom, component)
if (component->driver->pcm_destruct)
component->driver->pcm_destruct(component, pcm);
component->driver->pcm_destruct(component, rtd->pcm);
}
19 changes: 11 additions & 8 deletions sound/soc/soc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,9 @@ static void soc_free_pcm_runtime(struct snd_soc_pcm_runtime *rtd)

list_del(&rtd->list);

flush_delayed_work(&rtd->delayed_work);
snd_soc_pcm_component_free(rtd);

/*
* we don't need to call kfree() for rtd->dev
* see
Expand Down Expand Up @@ -1984,17 +1987,12 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card)
{
struct snd_soc_dai_link *link, *_link;

/* This should be called before snd_card_free() */
soc_remove_link_components(card);

/* free the ALSA card at first; this syncs with pending operations */
if (card->snd_card) {
snd_card_free(card->snd_card);
card->snd_card = NULL;
}
if (card->snd_card)
snd_card_disconnect_sync(card->snd_card);

/* remove and free each DAI */
soc_remove_link_dais(card);
soc_remove_link_components(card);

for_each_card_links_safe(card, link, _link)
snd_soc_remove_dai_link(card, link);
Expand All @@ -2009,6 +2007,11 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card)
/* remove the card */
if (card->remove)
card->remove(card);

if (card->snd_card) {
snd_card_free(card->snd_card);
card->snd_card = NULL;
}
}

static int snd_soc_instantiate_card(struct snd_soc_card *card)
Expand Down
10 changes: 0 additions & 10 deletions sound/soc/soc-pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -2892,15 +2892,6 @@ static int dpcm_fe_dai_close(struct snd_pcm_substream *fe_substream)
return ret;
}

static void soc_pcm_private_free(struct snd_pcm *pcm)
{
struct snd_soc_pcm_runtime *rtd = pcm->private_data;

/* need to sync the delayed work before releasing resources */
flush_delayed_work(&rtd->delayed_work);
snd_soc_pcm_component_free(pcm);
}

/* create a new pcm */
int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
{
Expand Down Expand Up @@ -3042,7 +3033,6 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
return ret;
}

pcm->private_free = soc_pcm_private_free;
pcm->no_device_suspend = true;
out:
dev_info(rtd->card->dev, "%s <-> %s mapping ok\n",
Expand Down