tests: mockup: don't fail at init-time if gpio-mockup is already loaded
authorBartosz Golaszewski <bgolaszewski@baylibre.com>
Wed, 7 Aug 2019 08:01:50 +0000 (10:01 +0200)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Wed, 7 Aug 2019 08:01:50 +0000 (10:01 +0200)
The comment in gpio_mockup_new() says we can deal with gpio-mockup
already being loaded, but it's wrong - we'd actually fail in the call
to kmod_module_probe_insert_module().

Pass the KMOD_PROBE_IGNORE_LOADED flag to the insert function to fix
that.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
tests/mockup/gpio-mockup.c

index 22a3a58ce9fefd7c8df2d166ce5d16d7c90aae58..e3a53da873ecb2c3ec63f41b1c89d12b1883deb0 100644 (file)
@@ -105,7 +105,8 @@ EXPORT struct gpio_mockup *gpio_mockup_new(void)
         * Then see if we can freely load and unload it. If it's already
         * loaded - no problem, we'll remove it next anyway.
         */
-       rv = kmod_module_probe_insert_module(ctx->module, 0,
+       rv = kmod_module_probe_insert_module(ctx->module,
+                                            KMOD_PROBE_IGNORE_LOADED,
                                             "gpio_mockup_ranges=-1,4",
                                             NULL, NULL, NULL);
        if (rv)