0003-bb_nvidia_umv_detection_bug699.patch 2.2 KB

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