From: ramesh.thomas at intel.com
To: accel-config@lists.01.org
Subject: [Accel-config] [PATCH v1 5/6] accel-config: Make idxd_mdev module optional
Date: Sat, 23 Jan 2021 00:35:41 -0500 [thread overview]
Message-ID: <20210123053542.615622-6-ramesh.thomas@intel.com> (raw)
In-Reply-To: 20210123053542.615622-1-ramesh.thomas@intel.com
[-- Attachment #1: Type: text/plain, Size: 1576 bytes --]
From: Ramesh Thomas <ramesh.thomas(a)intel.com>
Add conditional load and unload of idxd_mdev and make existence
of the module optional.
Signed-off-by: Ramesh Thomas <ramesh.thomas(a)intel.com>
---
test/libaccfg.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/test/libaccfg.c b/test/libaccfg.c
index 88108a9..031b7fa 100644
--- a/test/libaccfg.c
+++ b/test/libaccfg.c
@@ -1067,12 +1067,16 @@ static int idxd_kmod_init(struct kmod_ctx **ctx, struct kmod_module **mod,
if (rc == -ENOENT)
rc = kmod_module_probe_insert_module(*mdev_mod, 0, NULL, NULL, NULL,
NULL);
- if (rc >= 0)
- rc = kmod_module_get_initstate(*mod);
-
if (rc < 0) {
- kmod_module_unref(*mod);
kmod_module_unref(*mdev_mod);
+ *mdev_mod = NULL;
+ }
+ rc = kmod_module_get_initstate(*mod);
+ if (rc == -ENOENT)
+ rc = kmod_module_probe_insert_module(*mod, 0, NULL, NULL, NULL,
+ NULL);
+ if (rc < 0) {
+ kmod_module_unref(*mod);
kmod_unref(*ctx);
}
@@ -1140,10 +1144,13 @@ int test_libaccfg(int loglevel, struct accfg_test *test,
test_cleanup(ctx);
- kmod_module_remove_module(mdev_mod, 0);
- kmod_module_probe_insert_module(mdev_mod, 0, NULL, NULL, NULL, NULL);
+ if (mdev_mod) {
+ kmod_module_remove_module(mdev_mod, 0);
+ kmod_module_unref(mdev_mod);
+ }
+ kmod_module_remove_module(mod, 0);
+ kmod_module_probe_insert_module(mod, 0, NULL, NULL, NULL, NULL);
kmod_module_unref(mod);
- kmod_module_unref(mdev_mod);
kmod_unref(kmod_ctx);
return result;
--
2.26.2
reply other threads:[~2021-01-23 5:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210123053542.615622-6-ramesh.thomas@intel.com \
--to=accel-config@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.