[PATCH i-g-t 1/2] lib/igt_kmod: Export igt_kmod_unbind()
Umesh Nerlige Ramappa
umesh.nerlige.ramappa at intel.com
Mon Nov 4 19:24:43 UTC 2024
On Tue, Oct 22, 2024 at 10:05:01PM -0700, Lucas De Marchi wrote:
>So it can be used directly by tests and other libs.
>
>Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
Tried it with Peter's patches and seems to work fine. Ran into the
CONFIG_PM case, but you have addressed that in another patch, so this is
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
Thanks,
Umesh
>---
> 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
>
More information about the igt-dev
mailing list