45 lines
1.2 KiB
Diff
45 lines
1.2 KiB
Diff
From bcfe4dd16dd6194f1edbdc53b874a4f408343c5c Mon Sep 17 00:00:00 2001
|
|
From: Abuzer Rafey <abuzer@rafey.xyz>
|
|
Date: Wed, 13 Apr 2016 01:11:09 -0400
|
|
Subject: [PATCH] Workaround for nvidia_drm in newer drivers
|
|
|
|
---
|
|
src/module.c | 20 ++++++++++++++++++++
|
|
1 file changed, 20 insertions(+)
|
|
|
|
diff --git a/src/module.c b/src/module.c
|
|
index b5a4d79..db9736a 100644
|
|
--- a/src/module.c
|
|
+++ b/src/module.c
|
|
@@ -113,6 +113,25 @@ int module_unload(char *driver) {
|
|
}
|
|
}
|
|
|
|
+ else if (module_is_loaded("nvidia_drm") == 1) {
|
|
+ int retries = 30;
|
|
+ bb_log(LOG_INFO, "Unloading nvidia_drm driver\n");
|
|
+ char *mod_argv[] = {
|
|
+ "modprobe",
|
|
+ "-r",
|
|
+ "nvidia_drm",
|
|
+ NULL
|
|
+ };
|
|
+ bb_run_fork_wait(mod_argv, 10);
|
|
+ while (retries-- > 0 && module_is_loaded("nvidia_drm") == 1) {
|
|
+ usleep(100000);
|
|
+ }
|
|
+ if (module_is_loaded(driver) == 1) {
|
|
+ bb_log(LOG_ERR, "Unloading %s driver timed out.\n", driver);
|
|
+ return 0;
|
|
+ }
|
|
+ }
|
|
+
|
|
else if (module_is_loaded("nvidia_modeset") == 1) {
|
|
int retries = 30;
|
|
bb_log(LOG_INFO, "Unloading nvidia_modeset driver\n");
|
|
@@ -175,3 +194,4 @@ int module_is_available(char *module_name) {
|
|
};
|
|
return bb_run_fork(mod_argv, 1) == EXIT_SUCCESS;
|
|
}
|
|
+
|