1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
From dbbf20a38aa2bffb10c4e8af583b34dff6bfe721 Mon Sep 17 00:00:00 2001
From: Abuzer Rafey <abuzer@rafey.ch>
Date: Wed, 9 Dec 2015 21:26:29 -0500
Subject: [PATCH] Fix nvidia_uvm just like nvidia_modeset
---
src/module.c | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/src/module.c b/src/module.c
index eea0139..b5a4d79 100644
--- a/src/module.c
+++ b/src/module.c
@@ -93,19 +93,18 @@ int module_load(char *module_name, char *driver) {
*/
int module_unload(char *driver) {
- if (module_is_loaded(driver) == 1 &&
- module_is_loaded("nvidia_modeset") == 1) {
+ if (module_is_loaded("nvidia_uvm") == 1) {
int retries = 30;
- bb_log(LOG_INFO, "Unloading %s driver\n", driver);
+ bb_log(LOG_INFO, "Unloading nvidia_uvm driver\n");
char *mod_argv[] = {
"modprobe",
"-r",
- "nvidia-modeset",
- driver,
+ "nvidia_uvm",
+ "nvidia_modeset",
NULL
};
bb_run_fork_wait(mod_argv, 10);
- while (retries-- > 0 && module_is_loaded(driver) == 1) {
+ while (retries-- > 0 && module_is_loaded("nvidia_uvm") == 1) {
usleep(100000);
}
if (module_is_loaded(driver) == 1) {
@@ -113,7 +112,27 @@ int module_unload(char *driver) {
return 0;
}
}
- else if (module_is_loaded(driver) == 1) {
+
+ else if (module_is_loaded("nvidia_modeset") == 1) {
+ int retries = 30;
+ bb_log(LOG_INFO, "Unloading nvidia_modeset driver\n");
+ char *mod_argv[] = {
+ "modprobe",
+ "-r",
+ "nvidia_modeset",
+ NULL
+ };
+ bb_run_fork_wait(mod_argv, 10);
+ while (retries-- > 0 && module_is_loaded("nvidia_modeset") == 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(driver) == 1) {
int retries = 30;
bb_log(LOG_INFO, "Unloading %s driver\n", driver);
char *mod_argv[] = {
@@ -130,7 +149,7 @@ int module_unload(char *driver) {
bb_log(LOG_ERR, "Unloading %s driver timed out.\n", driver);
return 0;
}
- }
+ }
return 1;
}
|