summaryrefslogtreecommitdiff
path: root/lib/igt_kmod.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-07-11 09:42:53 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-07-11 09:45:23 +0100
commit4dc2ce0e362143d98cd2f95eea30b1173b861484 (patch)
tree2aaa51f671d5782a96e56ebe92038b6487f05f07 /lib/igt_kmod.c
parente8905e756cf3640c66541e963ff97f8af2d98936 (diff)
lib/kmod: Fail if the module is already loaded
If we want to set new module options, we must load the module or die trying. We may want to always fail if the module if already loaded, but for now, take the small incremental step and insist that the options are set if requested. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'lib/igt_kmod.c')
-rw-r--r--lib/igt_kmod.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 4f70e30d..f3f34a62 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -141,7 +141,13 @@ out:
static int modprobe(struct kmod_module *kmod, const char *options)
{
- return kmod_module_probe_insert_module(kmod, 0, options,
+ unsigned int flags;
+
+ flags = 0;
+ if (options) /* force a fresh load to set the new options */
+ flags |= KMOD_PROBE_FAIL_ON_LOADED;
+
+ return kmod_module_probe_insert_module(kmod, flags, options,
NULL, NULL, NULL);
}