- add kernel epoch, adapterized
[packages/xorg-driver-video-nvidia.git] / NVIDIA_kernel-1.0-6629-1182399.diff
CommitLineData
517a48eb
PS
1diff -ru usr/src/nv/nv-linux.h usr/src/nv.1182399/nv-linux.h
2--- usr/src/nv/nv-linux.h 2004-11-03 22:53:00.000000000 +0100
3+++ usr/src/nv.1182399/nv-linux.h 2004-12-21 18:58:41.000000000 +0100
4@@ -155,6 +155,10 @@
5 #endif
6 #endif /* defined(NVCPU_X86) */
7
8+#ifndef get_cpu
9+#define get_cpu() smp_processor_id()
10+#define put_cpu()
11+#endif
12
13 #if !defined (list_for_each)
14 #define list_for_each(pos, head) \
15diff -ru usr/src/nv/nv.c usr/src/nv.1182399/nv.c
16--- usr/src/nv/nv.c 2004-11-03 22:53:00.000000000 +0100
17+++ usr/src/nv.1182399/nv.c 2004-12-21 18:58:55.000000000 +0100
18@@ -2769,21 +2769,13 @@
19 }
20
21
22-/* avoid compiler warnings on UP kernels,
23- * when spinlock macros are defined away
24- */
25-#define NO_COMPILER_WARNINGS(nvl) \
26- if (nvl == NULL) return
27-
28-
29 static void nv_lock_init_locks
30 (
31 nv_state_t *nv
32 )
33 {
34- nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
35-
36- NO_COMPILER_WARNINGS(nvl);
37+ nv_linux_state_t *nvl;
38+ nvl = NV_GET_NVL_FROM_NV_STATE(nv);
39
40 spin_lock_init(&nvl->rm_lock);
41
42@@ -2799,28 +2791,33 @@
43 nv_state_t *nv
44 )
45 {
46- nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
47- NO_COMPILER_WARNINGS(nvl);
48+ nv_linux_state_t *nvl;
49+ int cpu;
50+
51+ nvl = NV_GET_NVL_FROM_NV_STATE(nv);
52+ cpu = get_cpu();
53
54- if (nvl->rm_lock_cpu == smp_processor_id())
55+ if (nvl->rm_lock_cpu == cpu)
56 {
57 nvl->rm_lock_count++;
58+ put_cpu();
59 return;
60 }
61
62+ put_cpu();
63 spin_unlock_wait(&nvl->rm_lock);
64 spin_lock_irq(&nvl->rm_lock);
65
66- nvl->rm_lock_cpu = smp_processor_id();
67- nvl->rm_lock_count = 1;
68+ nvl->rm_lock_cpu = smp_processor_id();
69+ nvl->rm_lock_count = 1;
70 }
71
72 void NV_API_CALL nv_unlock_rm(
73 nv_state_t *nv
74 )
75 {
76- nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
77- NO_COMPILER_WARNINGS(nvl);
78+ nv_linux_state_t *nvl;
79+ nvl = NV_GET_NVL_FROM_NV_STATE(nv);
80
81 if (--nvl->rm_lock_count)
82 return;
83diff -ru usr/src/nv/os-interface.c usr/src/nv.1182399/os-interface.c
84--- usr/src/nv/os-interface.c 2004-11-03 22:53:00.000000000 +0100
85+++ usr/src/nv.1182399/os-interface.c 2004-12-21 18:58:47.000000000 +0100
86@@ -732,10 +732,17 @@
87 //
88 inline void NV_API_CALL out_string(const char *str)
89 {
90+#if DEBUG
91 static int was_newline = 0;
92
93- if (was_newline) printk("%d: %s", smp_processor_id(), str);
94- else printk("%s", str);
95+ if (NV_NUM_CPUS() > 1 && was_newline)
96+ {
97+ printk("%d: %s", get_cpu(), str);
98+ put_cpu();
99+ }
100+ else
101+#endif
102+ printk("%s", str);
103
104 #if DEBUG
105 if (NV_NUM_CPUS() > 1)
This page took 0.086755 seconds and 4 git commands to generate.