summaryrefslogtreecommitdiff
path: root/lib/igt_kmod.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@kernel.org>2022-04-28 13:19:12 +0200
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-05-18 12:04:51 +0200
commit31d3b9913d718ba949a258bd02045aed2af5fd76 (patch)
treeb2a3bcdef499d184ca18890a4ba27745ff086583 /lib/igt_kmod.c
parent0edabd8a4a0810162be5f4b5e74c6b333f2d3a30 (diff)
lib/igt_kmod: make it less pedantic with audio driver removal
Current Linux Kernel don't report if the audio driver binds into the DRM driver. As this is CPU specific, allow audio driver unload fail without skipping the IGT tests on legacy Kernels, as this may not be mandatory. On new kernels where lsmod will properly display the dependency between the audio and DRM drivers, skip the core hotunplug test if it fails to unload the audio driver, as this is unrelated to the DRM driver - and it could simply because there are some userspace code using the audio device while the IGT test is running. Reviewed-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'lib/igt_kmod.c')
-rw-r--r--lib/igt_kmod.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 9bb2fc70..5d358c89 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -408,18 +408,34 @@ static int igt_always_unload_audio_driver(char **who)
NULL,
};
+ /*
+ * With old Kernels, the dependencies between audio and DRM drivers
+ * are not shown. So, it may not be mandatory to remove the audio
+ * driver before unload/unbind the DRM one. So, let's print warnings,
+ * but return 0 on errors, as, if the dependency is mandatory, this
+ * will be detected later when trying to unbind/unload the DRM driver.
+ */
for (const char **m = sound; *m; m++) {
if (igt_kmod_is_loaded(*m)) {
if (who)
*who = strdup_realloc(*who, *m);
- if (igt_lsof_kill_audio_processes())
- return EACCES;
+ ret = igt_lsof_kill_audio_processes();
+ if (ret) {
+ igt_warn("Could not stop %d audio process(es)\n", ret);
+ igt_kmod_list_loaded();
+ igt_lsof("/dev/snd");
+ return 0;
+ }
kick_snd_hda_intel();
ret = igt_kmod_unload(*m, 0);
- if (ret)
- return ret;
+ if (ret) {
+ igt_warn("Could not unload audio driver %s\n", *m);
+ igt_kmod_list_loaded();
+ igt_lsof("/dev/snd");
+ return 0;
+ }
}
}
return 0;
@@ -610,6 +626,13 @@ int igt_audio_driver_unload(char **who)
}
ret:
+ if (ret) {
+ igt_warn("Couldn't unload %s, which is using the %s driver\n",
+ mod[pos].name, drm_driver);
+ igt_kmod_list_loaded();
+ igt_lsof("/dev/snd");
+ }
+
free_module_ref(mod, num_mod);
return ret;