summaryrefslogtreecommitdiff
path: root/tests/core_hotunplug.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@kernel.org>2022-04-13 10:26:48 +0200
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-05-18 11:51:45 +0200
commitbc200c9aa672552e6992634b4aaf93a99ce64da3 (patch)
treed50675b6224187ca14e5dbb6ae4606179fde70ee /tests/core_hotunplug.c
parent7c3ceb08b633a66f77f42e596593de394da5dccc (diff)
tests/core_hotunplug: properly finish processes using audio devices
Before unloading or unbinding an audio driver, all processes that are using it must be terminated. The current logic seeks only for alsactl, but ignore other processes, including pulseaudio. Make the logic more general, extending it to any processes that could have an open device under /dev/snd. It should be noticed that some distros like Fedora and openSUSE are now migrating from pulseaudio into pipewire-pulse. Right now, there's no standard distribution-agnostic way to request pipewire-pulse to stop using audio devices, but there's a new patch upstream that will make things easier: https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/6ad6300ec657c88322a8cd6f3548261d3dc05359 Which should be available for pipewire-pulse versions 0.3.50 and upper. Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'tests/core_hotunplug.c')
-rw-r--r--tests/core_hotunplug.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/tests/core_hotunplug.c b/tests/core_hotunplug.c
index 02eae19e..18e37ec8 100644
--- a/tests/core_hotunplug.c
+++ b/tests/core_hotunplug.c
@@ -152,19 +152,14 @@ static void driver_unbind(struct hotunplug *priv, const char *prefix,
* safest and easiest way out.
*/
if (priv->snd_unload) {
- igt_terminate_process(SIGTERM, "alsactl");
-
- /* unbind snd_hda_intel */
- kick_snd_hda_intel();
-
- if (igt_kmod_unload("snd_hda_intel", 0)) {
+ if (igt_audio_driver_unload(NULL)) {
priv->snd_unload = false;
- igt_warn("Could not unload snd_hda_intel\n");
+ igt_warn("Could not unload audio driver\n");
igt_kmod_list_loaded();
igt_lsof("/dev/snd");
igt_skip("Audio is in use, skipping\n");
} else {
- igt_info("Preventively unloaded snd_hda_intel\n");
+ igt_info("Preventively unloaded audio driver\n");
}
}