Repository navigation
ASoC/SoundWire: fix two issues for rmmod/modprobe machine driver tests #3534
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
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 |
|---|---|---|
|
|
@@ -1065,6 +1065,46 @@ static int sof_connect_dai_widget(struct snd_soc_component *scomp, | |
| return 0; | ||
| } | ||
|
|
||
| static void sof_disconnect_dai_widget(struct snd_soc_component *scomp, | ||
| struct snd_soc_dapm_widget *w) | ||
| { | ||
| struct snd_soc_card *card = scomp->card; | ||
| struct snd_soc_pcm_runtime *rtd; | ||
| struct snd_soc_dai *cpu_dai; | ||
| int i; | ||
|
|
||
| list_for_each_entry(rtd, &card->rtd_list, list) { | ||
|
|
||
| if (!w->sname || !rtd->dai_link->stream_name) | ||
|
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. the
Member
Author
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. it's the same loop as in the 'register' case, so I just copy-pasted. we can change the loop but we have to do it consistently in the register and unregister cases |
||
| continue; | ||
|
|
||
| /* does stream match DAI link ? */ | ||
| if (strcmp(w->sname, rtd->dai_link->stream_name)) | ||
|
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.
Member
Author
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. same, it's the same loop as in the 'register' case, so I just copy-pasted. we can change the loop but we have to do it consistently in the register and unregister cases
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 see. The |
||
| continue; | ||
|
|
||
| switch (w->id) { | ||
| case snd_soc_dapm_dai_out: | ||
| for_each_rtd_cpu_dais(rtd, i, cpu_dai) { | ||
| if (cpu_dai->capture_widget == w) { | ||
| cpu_dai->capture_widget = NULL; | ||
| break; | ||
| } | ||
| } | ||
| break; | ||
| case snd_soc_dapm_dai_in: | ||
| for_each_rtd_cpu_dais(rtd, i, cpu_dai) { | ||
| if (cpu_dai->playback_widget == w) { | ||
| cpu_dai->playback_widget = NULL; | ||
| break; | ||
| } | ||
| } | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /* bind PCM ID to host component ID */ | ||
| static int spcm_bind(struct snd_soc_component *scomp, struct snd_sof_pcm *spcm, | ||
| int dir) | ||
|
|
@@ -1383,6 +1423,9 @@ static int sof_widget_unload(struct snd_soc_component *scomp, | |
|
|
||
| if (dai) | ||
| list_del(&dai->list); | ||
|
|
||
| sof_disconnect_dai_widget(scomp, widget); | ||
|
|
||
| break; | ||
| default: | ||
| break; | ||
|
|
||
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 set
slave->ops = NULL;whendev_pm_domain_attachreturn error , too?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.
yes indeed, thanks for spotting this @bardliao