Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [CI 1/2] lib/igt_kmod: Export igt_kmod_unbind()
Date: Tue, 22 Oct 2024 21:55:10 -0700	[thread overview]
Message-ID: <20241023045511.3047422-2-lucas.demarchi@intel.com> (raw)
In-Reply-To: <20241023045511.3047422-1-lucas.demarchi@intel.com>

So it can be used directly by tests and other libs.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 lib/igt_kmod.c | 6 +++---
 lib/igt_kmod.h | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
index 75a0d057c..039309328 100644
--- a/lib/igt_kmod.c
+++ b/lib/igt_kmod.c
@@ -663,7 +663,7 @@ int __igt_intel_driver_unload(char **who, const char *driver)
 /*
  * Unbind driver from devices. Currently supports only PCI bus
  */
-static int unbind(const char *driver)
+int igt_kmod_unbind(const char *mod_name)
 {
 	char path[PATH_MAX];
 	struct dirent *de;
@@ -671,7 +671,7 @@ static int unbind(const char *driver)
 	DIR *dir;
 
 	dirlen = snprintf(path, sizeof(path), "/sys/module/%s/drivers/pci:%s/",
-			  driver, driver);
+			  mod_name, mod_name);
 	igt_assert(dirlen < sizeof(path));
 
 	dir = opendir(path);
@@ -744,7 +744,7 @@ igt_intel_driver_unload(const char *driver)
 
 int igt_xe_driver_unload(void)
 {
-	unbind("xe");
+	igt_kmod_unbind("xe");
 
 	igt_kmod_unload("xe");
 	if (igt_kmod_is_loaded("xe"))
diff --git a/lib/igt_kmod.h b/lib/igt_kmod.h
index ee1719a8f..193b95627 100644
--- a/lib/igt_kmod.h
+++ b/lib/igt_kmod.h
@@ -36,6 +36,8 @@ bool igt_kmod_has_param(const char *mod_name, const char *param);
 int igt_kmod_load(const char *mod_name, const char *opts);
 int igt_kmod_unload(const char *mod_name);
 
+int igt_kmod_unbind(const char *mod_name);
+
 int igt_audio_driver_unload(char **whom);
 
 int igt_intel_driver_load(const char *opts, const char *driver);
-- 
2.47.0


  reply	other threads:[~2024-10-23  4:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-23  4:55 [CI 0/2] Test pmu unbind (xfail) Lucas De Marchi
2024-10-23  4:55 ` Lucas De Marchi [this message]
2024-10-23  4:55 ` [CI 2/2] tests/intel/perf_pmu: Migrate to unbind + unload Lucas De Marchi
2024-10-23  5:46 ` ✓ CI.xeBAT: success for Test pmu unbind (xfail) Patchwork
2024-10-23  5:51 ` ✓ Fi.CI.BAT: " Patchwork
2024-10-23  8:33 ` ✓ Fi.CI.IGT: " Patchwork
2024-10-23  9:20 ` ✗ CI.xeFULL: failure " Patchwork

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=20241023045511.3047422-2-lucas.demarchi@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=igt-dev@lists.freedesktop.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox