x11/nvidia-driver cleanup patch

Emiel Kollof coolvibe at hackerheaven.org
Wed Mar 10 03:54:13 PST 2004


Hi,

This patch contains the following cleanups to the nvidia-driver override 
ports:

- lockmgr cleanups (0 -> NULL)
- malloc M_NOWAIT -> M_WAITOK cleanups

Please test and/or commit.

Cheers,
Emiel
Index: files/patch-dfly
===================================================================
RCS file: /home/dcvs/dfports/x11/nvidia-driver/files/patch-dfly,v
retrieving revision 1.2
diff -u -u -r1.2 patch-dfly
--- files/patch-dfly	27 Feb 2004 17:19:10 -0000	1.2
+++ files/patch-dfly	10 Mar 2004 11:46:32 -0000
@@ -1,6 +1,6 @@
-diff -urN ./module/Makefile ../../nvidia-patched/module/Makefile
+diff -urN ./module/Makefile ../../NVIDIA-patched/module/Makefile
 --- ./module/Makefile	Wed May 28 18:51:52 2003
-+++ ../../nvidia-patched/module/Makefile	Wed Feb 25 19:35:22 2004
++++ ../../NVIDIA-patched/module/Makefile	Wed Mar 10 12:45:32 2004
 @@ -6,7 +6,7 @@
  KMOD=		nvidia
  SRCS=		nvidia_ctl.c nvidia_dev.c nvidia_linux.c nvidia_os.c nvidia_os_pci.c nvidia_os_registry.c nvidia_pci.c nvidia_subr.c nvidia_sysctl.c 
@@ -10,9 +10,9 @@
  NVOBJ=		${NVIDIA_ROOT}/obj/nv-kernel.o
  OBJS+=		NVIDIA.o
  NOOBJ=		true
-diff -urN ./src/nv-dragonfly.h ../../nvidia-patched/src/nv-dragonfly.h
+diff -urN ./src/nv-dragonfly.h ../../NVIDIA-patched/src/nv-dragonfly.h
 --- ./src/nv-dragonfly.h	Thu Jan  1 01:00:00 1970
-+++ ../../nvidia-patched/src/nv-dragonfly.h	Wed Feb 25 19:32:38 2004
++++ ../../NVIDIA-patched/src/nv-dragonfly.h	Wed Mar 10 12:45:32 2004
 @@ -0,0 +1,295 @@
 +/* _NVRM_COPYRIGHT_BEGIN_
 + *
@@ -309,9 +309,9 @@
 +
 +#endif /* __NV_DRAGONFLY_H */
 +
-diff -urN ./src/nvidia_ctl.c ../../nvidia-patched/src/nvidia_ctl.c
+diff -urN ./src/nvidia_ctl.c ../../NVIDIA-patched/src/nvidia_ctl.c
 --- ./src/nvidia_ctl.c	Wed May 28 18:51:52 2003
-+++ ../../nvidia-patched/src/nvidia_ctl.c	Wed Feb 25 19:32:38 2004
++++ ../../NVIDIA-patched/src/nvidia_ctl.c	Wed Mar 10 12:45:32 2004
 @@ -11,7 +11,11 @@
  #include "nv-misc.h"
  #include "os-interface.h"
@@ -385,13 +385,13 @@
 +#elif defined(__FreeBSD__) && !defined(__DragonFly__)
          lockmgr(&sc->api_lock, LK_DRAIN, 0, curproc);
 +#else 
-+        lockmgr(&sc->api_lock, LK_DRAIN, 0, curthread);
++        lockmgr(&sc->api_lock, LK_DRAIN, NULL, curthread);
  #endif
          destroy_dev(nvidia_ctl_cdev);
      }
-diff -urN ./src/nvidia_dev.c ../../nvidia-patched/src/nvidia_dev.c
+diff -urN ./src/nvidia_dev.c ../../NVIDIA-patched/src/nvidia_dev.c
 --- ./src/nvidia_dev.c	Wed May 28 18:51:52 2003
-+++ ../../nvidia-patched/src/nvidia_dev.c	Wed Feb 25 19:32:38 2004
++++ ../../NVIDIA-patched/src/nvidia_dev.c	Wed Mar 10 12:45:32 2004
 @@ -11,7 +11,11 @@
  #include "nv-misc.h"
  #include "os-interface.h"
@@ -449,9 +449,9 @@
  };
  
  int nvidia_dev_open(
-diff -urN ./src/nvidia_linux.c ../../nvidia-patched/src/nvidia_linux.c
+diff -urN ./src/nvidia_linux.c ../../NVIDIA-patched/src/nvidia_linux.c
 --- ./src/nvidia_linux.c	Wed May 28 18:51:52 2003
-+++ ../../nvidia-patched/src/nvidia_linux.c	Wed Feb 25 19:32:38 2004
++++ ../../NVIDIA-patched/src/nvidia_linux.c	Wed Mar 10 12:45:32 2004
 @@ -11,7 +11,11 @@
  #include "nv-misc.h"
  #include "os-interface.h"
@@ -476,9 +476,9 @@
  }
  
  struct linux_ioctl_handler nvidia_handler = {
-diff -urN ./src/nvidia_os.c ../../nvidia-patched/src/nvidia_os.c
+diff -urN ./src/nvidia_os.c ../../NVIDIA-patched/src/nvidia_os.c
 --- ./src/nvidia_os.c	Wed May 28 18:51:52 2003
-+++ ../../nvidia-patched/src/nvidia_os.c	Wed Feb 25 19:51:00 2004
++++ ../../NVIDIA-patched/src/nvidia_os.c	Wed Mar 10 12:45:32 2004
 @@ -11,7 +11,11 @@
  #include "nv-misc.h"
  #include "os-interface.h"
@@ -491,7 +491,19 @@
  
  
  /*
-@@ -164,7 +168,7 @@
+@@ -94,7 +98,11 @@
+     U032 size
+ )
+ {
++#ifndef __DragonFly__
+     *address = malloc(size, M_NVIDIA, M_NOWAIT|M_ZERO);
++#else 
++    *address = malloc(size, M_NVIDIA, M_WAITOK|M_ZERO);
++#endif
+     return *address ? RM_OK : RM_ERROR;
+ }
+ 
+@@ -164,7 +172,7 @@
  
  BOOL os_is_administrator(PHWINFO pDev)
  {
@@ -500,7 +512,7 @@
      return suser(curproc);
  #else
      return suser(curthread);
-@@ -301,7 +305,11 @@
+@@ -301,7 +309,11 @@
              *pte |= PG_N;
              va += PAGE_SIZE;
          } while (va < (vm_offset_t) vm + size);
@@ -512,9 +524,9 @@
      }
  
      return vm;
-diff -urN ./src/nvidia_os_pci.c ../../nvidia-patched/src/nvidia_os_pci.c
+diff -urN ./src/nvidia_os_pci.c ../../NVIDIA-patched/src/nvidia_os_pci.c
 --- ./src/nvidia_os_pci.c	Wed May 28 18:51:52 2003
-+++ ../../nvidia-patched/src/nvidia_os_pci.c	Wed Feb 25 19:32:38 2004
++++ ../../NVIDIA-patched/src/nvidia_os_pci.c	Wed Mar 10 12:45:32 2004
 @@ -11,7 +11,11 @@
  #include "nv-misc.h"
  #include "os-interface.h"
@@ -527,9 +539,9 @@
  
  
  VOID* os_pci_init_handle(
-diff -urN ./src/nvidia_os_registry.c ../../nvidia-patched/src/nvidia_os_registry.c
+diff -urN ./src/nvidia_os_registry.c ../../NVIDIA-patched/src/nvidia_os_registry.c
 --- ./src/nvidia_os_registry.c	Wed May 28 18:51:52 2003
-+++ ../../nvidia-patched/src/nvidia_os_registry.c	Wed Feb 25 19:32:38 2004
++++ ../../NVIDIA-patched/src/nvidia_os_registry.c	Wed Mar 10 12:45:32 2004
 @@ -11,7 +11,11 @@
  #include "nv-misc.h"
  #include "os-interface.h"
@@ -542,9 +554,9 @@
  
  
  /*
-diff -urN ./src/nvidia_pci.c ../../nvidia-patched/src/nvidia_pci.c
+diff -urN ./src/nvidia_pci.c ../../NVIDIA-patched/src/nvidia_pci.c
 --- ./src/nvidia_pci.c	Wed May 28 18:51:52 2003
-+++ ../../nvidia-patched/src/nvidia_pci.c	Wed Feb 25 19:32:38 2004
++++ ../../NVIDIA-patched/src/nvidia_pci.c	Wed Mar 10 12:45:32 2004
 @@ -11,7 +11,11 @@
  #include "nv-misc.h"
  #include "os-interface.h"
@@ -577,13 +589,13 @@
 +#elif !defined(__DragonFly__)
      lockmgr(&sc->api_lock, LK_DRAIN, 0, curproc);
 +#else
-+    lockmgr(&sc->api_lock, LK_DRAIN, 0, curthread);
++    lockmgr(&sc->api_lock, LK_DRAIN, NULL, curthread);
  #endif
  
      status = nvidia_detach(dev);
-diff -urN ./src/nvidia_subr.c ../../nvidia-patched/src/nvidia_subr.c
+diff -urN ./src/nvidia_subr.c ../../NVIDIA-patched/src/nvidia_subr.c
 --- ./src/nvidia_subr.c	Wed May 28 18:51:52 2003
-+++ ../../nvidia-patched/src/nvidia_subr.c	Wed Feb 25 19:32:38 2004
++++ ../../NVIDIA-patched/src/nvidia_subr.c	Wed Mar 10 12:45:32 2004
 @@ -11,7 +11,11 @@
  #include "nv-misc.h"
  #include "os-interface.h"
@@ -627,7 +639,7 @@
 +#ifndef __DragonFly__
      lockmgr(&sc->api_lock, LK_EXCLUSIVE, 0, curproc);
 +#else
-+    lockmgr(&sc->api_lock, LK_EXCLUSIVE, 0, curthread);
++    lockmgr(&sc->api_lock, LK_EXCLUSIVE, NULL, curthread);
 +#endif
 +
  #endif
@@ -640,15 +652,15 @@
 +#ifndef __DragonFly__
      lockmgr(&sc->api_lock, LK_RELEASE, 0, curproc);
 +#else
-+    lockmgr(&sc->api_lock, LK_RELEASE, 0, curthread);
++    lockmgr(&sc->api_lock, LK_RELEASE, NULL, curthread);
 +#endif
 +
  #endif
  }
  
-diff -urN ./src/nvidia_sysctl.c ../../nvidia-patched/src/nvidia_sysctl.c
+diff -urN ./src/nvidia_sysctl.c ../../NVIDIA-patched/src/nvidia_sysctl.c
 --- ./src/nvidia_sysctl.c	Wed May 28 18:51:52 2003
-+++ ../../nvidia-patched/src/nvidia_sysctl.c	Wed Feb 25 19:50:41 2004
++++ ../../NVIDIA-patched/src/nvidia_sysctl.c	Wed Mar 10 12:45:32 2004
 @@ -11,7 +11,11 @@
  #include "nv-misc.h"
  #include "os-interface.h"




More information about the Submit mailing list