summaryrefslogtreecommitdiff
path: root/x11-drivers/nvidia-drivers/files/nvidia-drivers-304-3.10.patch
blob: 514e671ef4c7eb4fb9285b5d3ebf0d8fbf4442e5 (plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
diff -Nurp work.orig/kernel/nv-i2c.c work/kernel/nv-i2c.c
--- work.orig/kernel/nv-i2c.c	2013-07-04 13:19:12.255911539 +0000
+++ work/kernel/nv-i2c.c	2013-07-04 13:08:08.479793566 +0000
@@ -311,8 +311,6 @@ void* NV_API_CALL nv_i2c_add_adapter(nv_
 BOOL NV_API_CALL nv_i2c_del_adapter(nv_state_t *nv, void *data)
 {
     struct i2c_adapter *pI2cAdapter = (struct i2c_adapter *)data;
-    int osstatus = 0;
-    BOOL wasReleased = FALSE;
 
 #if defined(KERNEL_2_4)
     if (!NV_WEAK_SYMBOL_PRESENT(i2c_add_adapter))
@@ -324,15 +322,10 @@ BOOL NV_API_CALL nv_i2c_del_adapter(nv_s
     if (!pI2cAdapter) return FALSE;
 
     // attempt release with the OS
-    osstatus = i2c_del_adapter(pI2cAdapter);
+    i2c_del_adapter(pI2cAdapter);
+    os_free_mem(pI2cAdapter);
 
-    if (!osstatus)
-    {
-        os_free_mem(pI2cAdapter);
-        wasReleased = TRUE;
-    }
-
-    return wasReleased;
+    return TRUE;
 }
 
 #else // (defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE))
diff -Nurp work.orig/kernel/nv-procfs.c work/kernel/nv-procfs.c
--- work.orig/kernel/nv-procfs.c	2013-07-04 13:19:12.259244771 +0000
+++ work/kernel/nv-procfs.c	2013-07-04 13:17:31.246205962 +0000
@@ -60,60 +60,41 @@ static char nv_registry_keys[NV_MAX_REGI
         __entry;                                          \
     })
 
-#define NV_CREATE_PROC_FILE(name,parent,__read_proc,           \
-    __write_proc,__fops,__data)                                \
-   ({                                                          \
-        struct proc_dir_entry *__entry;                        \
-        int __mode = (S_IFREG | S_IRUGO);                      \
-        if ((NvUPtr)(__write_proc) != 0)                       \
-            __mode |= S_IWUSR;                                 \
-        __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent);  \
-        if (__entry != NULL)                                   \
-        {                                                      \
-            if ((NvUPtr)(__read_proc) != 0)                    \
-                __entry->read_proc = (__read_proc);            \
-            if ((NvUPtr)(__write_proc) != 0)                   \
-            {                                                  \
-                __entry->write_proc = (__write_proc);          \
-                __entry->proc_fops = (__fops);                 \
-            }                                                  \
-            __entry->data = (__data);                          \
-        }                                                      \
-        __entry;                                               \
-    })
+#define NV_PROC_RW (S_IFREG|S_IRUGO|S_IWUSR)
+#define NV_PROC_RO (S_IFREG|S_IRUGO)
 
 #define NV_CREATE_PROC_DIR(name,parent)                        \
    ({                                                          \
         struct proc_dir_entry *__entry;                        \
         int __mode = (S_IFDIR | S_IRUGO | S_IXUGO);            \
-        __entry = NV_CREATE_PROC_ENTRY(name, __mode, parent);  \
+        __entry = proc_mkdir_mode(name, __mode, parent);       \
         __entry;                                               \
     })
 
+//#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,9,255)
+//static inline void *PDE_DATA(const struct inode *inode) {
+//	return PDE(inode)->data;
+//}
+//#endif
+
 #define NV_PROC_WRITE_BUFFER_SIZE   (64 * RM_PAGE_SIZE)
 
 static int
-nv_procfs_read_gpu_info(
-    char  *page,
-    char **start,
-    off_t  off,
-    int    count,
-    int   *eof,
-    void  *data
+nv_procfs_show_gpu_info(
+    struct seq_file *m,
+    void *v
 )
 {
-    nv_state_t *nv = data;
+    nv_state_t *nv = m->private;
     nv_linux_state_t *nvl = NV_GET_NVL_FROM_NV_STATE(nv);
     struct pci_dev *dev = nvl->dev;
     char *type, *fmt, tmpstr[NV_DEVICE_NAME_LENGTH];
-    int len = 0, status;
+    int status;
     NvU8 *uuid;
     NvU32 vbios_rev1, vbios_rev2, vbios_rev3, vbios_rev4, vbios_rev5;
     NvU32 fpga_rev1, fpga_rev2, fpga_rev3;
     nv_stack_t *sp = NULL;
 
-    *eof = 1;
-
     NV_KMEM_CACHE_ALLOC_STACK(sp);
     if (sp == NULL)
     {
@@ -134,31 +115,31 @@ nv_procfs_read_gpu_info(
         if (rm_get_device_name(sp, nv, dev->device, dev->subsystem_vendor,
                     dev->subsystem_device, NV_DEVICE_NAME_LENGTH,
                     tmpstr) != RM_OK)
-        {
+ 		       {
             strcpy (tmpstr, "Unknown");
         }
     }
 
-    len += sprintf(page+len, "Model: \t\t %s\n", tmpstr);
-    len += sprintf(page+len, "IRQ:   \t\t %d\n", nv->interrupt_line);
+    seq_printf(m, "Model: \t\t %s\n", tmpstr);
+    seq_printf(m, "IRQ:   \t\t %d\n", nv->interrupt_line);
 
     if (NV_IS_GVI_DEVICE(nv))
     {
         status = rm_gvi_get_firmware_version(sp, nv, &fpga_rev1, &fpga_rev2,
                                              &fpga_rev3);
         if (status != RM_OK)
-            len += sprintf(page+len, "Firmware: \t ????.??.??\n");
+            seq_printf(m, "Firmware: \t ????.??.??\n");
         else
         {
             fmt = "Firmware: \t %x.%x.%x\n";
-            len += sprintf(page+len, fmt, fpga_rev1, fpga_rev2, fpga_rev3);
+            seq_printf(m, fmt, fpga_rev1, fpga_rev2, fpga_rev3);
         }
     }
     else
     {
         if (rm_get_gpu_uuid(sp, nv, &uuid, NULL) == RM_OK)
         {
-            len += sprintf(page+len, "GPU UUID: \t %s\n", (char *)uuid);
+            seq_printf(m, "GPU UUID: \t %s\n", (char *)uuid);
             os_free_mem(uuid);
         }
 
@@ -166,12 +147,12 @@ nv_procfs_read_gpu_info(
                     &vbios_rev3, &vbios_rev4,
                     &vbios_rev5) != RM_OK)
         {
-            len += sprintf(page+len, "Video BIOS: \t ??.??.??.??.??\n");
+            seq_printf(m, "Video BIOS: \t ??.??.??.??.??\n");
         }
         else
         {
             fmt = "Video BIOS: \t %02x.%02x.%02x.%02x.%02x\n";
-            len += sprintf(page+len, fmt, vbios_rev1, vbios_rev2, vbios_rev3,
+            seq_printf(m, fmt, vbios_rev1, vbios_rev2, vbios_rev3,
                            vbios_rev4, vbios_rev5);
         }
     }
@@ -182,12 +163,12 @@ nv_procfs_read_gpu_info(
         type = "PCI-E";
     else
         type = "PCI";
-    len += sprintf(page+len, "Bus Type: \t %s\n", type);
+    seq_printf(m, "Bus Type: \t %s\n", type);
 
-    len += sprintf(page+len, "DMA Size: \t %d bits\n",
+    seq_printf(m, "DMA Size: \t %d bits\n",
      nv_count_bits(dev->dma_mask));
-    len += sprintf(page+len, "DMA Mask: \t 0x%llx\n", dev->dma_mask);
-    len += sprintf(page+len, "Bus Location: \t %04x:%02x.%02x.%x\n",
+    seq_printf(m, "DMA Mask: \t 0x%llx\n", dev->dma_mask);
+    seq_printf(m, "Bus Location: \t %04x:%02x.%02x.%x\n",
                    nv->domain, nv->bus, nv->slot, PCI_FUNC(dev->devfn));
 #if defined(DEBUG)
     do
@@ -195,7 +176,7 @@ nv_procfs_read_gpu_info(
         int j;
         for (j = 0; j < NV_GPU_NUM_BARS; j++)
         {
-            len += sprintf(page+len, "BAR%u: \t\t 0x%llx (%lluMB)\n",
+            seq_printf(m, "BAR%u: \t\t 0x%llx (%lluMB)\n",
                            j, nv->bars[j].address, (nv->bars[j].size >> 20));
         }
     } while (0);
@@ -203,26 +184,120 @@ nv_procfs_read_gpu_info(
 
     NV_KMEM_CACHE_FREE_STACK(sp);
 
-    return len;
+    return 0;
 }
 
 static int
-nv_procfs_read_version(
-    char  *page,
-    char **start,
-    off_t  off,
-    int    count,
-    int   *eof,
-    void  *data
+nv_procfs_open_gpu_info(
+    struct inode *inode,
+    struct file *file
 )
 {
-    int len = 0;
-    *eof = 1;
+    return single_open(file, nv_procfs_show_gpu_info, PDE_DATA(inode));
+}
 
-    len += sprintf(page+len, "NVRM version: %s\n", pNVRM_ID);
-    len += sprintf(page+len, "GCC version:  %s\n", NV_COMPILER);
+static const struct file_operations nv_procfs_gpu_info_fops = {
+    .owner   = THIS_MODULE,
+    .open    = nv_procfs_open_gpu_info,
+    .read    = seq_read,
+    .llseek  = seq_lseek,
+    .release = single_release,
+};
 
-    return len;
+static int
+nv_procfs_show_version(
+    struct seq_file *m,
+    void *v
+)
+{
+    seq_printf(m, "NVRM version: %s\n", pNVRM_ID);
+    seq_printf(m, "GCC version:  %s\n", NV_COMPILER);
+
+    return 0;
+}
+
+static int
+nv_procfs_open_version(
+    struct inode *inode,
+    struct file *file
+)
+{
+    return single_open(file, nv_procfs_show_version, NULL);
+}
+
+static const struct file_operations nv_procfs_version_fops = {
+    .owner   = THIS_MODULE,
+    .open    = nv_procfs_open_version,
+    .read    = seq_read,
+    .llseek  = seq_lseek,
+    .release = single_release,
+};
+
+static int
+nv_procfs_show_registry(
+    struct seq_file *m,
+    void *v
+)
+{
+    nv_state_t *nv = m->private;
+    nv_linux_state_t *nvl = NULL;
+    char *registry_keys;
+
+    if (nv != NULL)
+        nvl = NV_GET_NVL_FROM_NV_STATE(nv);
+    registry_keys = ((nvl != NULL) ?
+            nvl->registry_keys : nv_registry_keys);
+
+    seq_printf(m, "Binary: \"%s\"\n", registry_keys);
+
+    return 0;
+}
+
+static ssize_t
+nv_procfs_write_registry(
+    struct file       *file,
+    const char __user *buffer,
+    size_t             count,
+    loff_t            *pos
+)
+{
+    int status = 0;
+    nv_file_private_t *nvfp = NV_GET_FILE_PRIVATE(file);
+    char *proc_buffer;
+    unsigned long bytes_left;
+
+    down(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
+
+    bytes_left = (NV_PROC_WRITE_BUFFER_SIZE - nvfp->off - 1);
+
+    if (count == 0)
+    {
+        status = -EINVAL;
+        goto done;
+    }
+    else if ((bytes_left == 0) || (count > bytes_left))
+    {
+        status = -ENOSPC;
+        goto done;
+    }
+
+    proc_buffer = &((char *)nvfp->data)[nvfp->off];
+
+    if (copy_from_user(proc_buffer, buffer, count))
+    {
+        nv_printf(NV_DBG_ERRORS, "NVRM: failed to copy in proc data!\n");
+        status = -EFAULT;
+    }
+    else
+    {
+        nvfp->proc_data = PDE_DATA(file->f_inode);
+        nvfp->off += count;
+    }
+
+done:
+    up(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
+
+    return ((status < 0) ? status : count);
 }
 
 static struct pci_dev *nv_get_agp_device_by_class(unsigned int class)
@@ -432,7 +507,7 @@ nv_procfs_open_registry(
     nv_stack_t *sp = NULL;
 
     if (0 == (file->f_mode & FMODE_WRITE))
-        return 0;
+        return single_open(file, nv_procfs_show_registry, PDE_DATA(inode));
 
     nvfp = nv_alloc_file_private();
     if (nvfp == NULL)
@@ -481,6 +556,9 @@ nv_procfs_close_registry(
     RM_STATUS rm_status;
     int rc = 0;
 
+    if (0 == (file->f_mode & FMODE_WRITE))
+        return single_release(inode, file);
+
     nvfp = NV_GET_FILE_PRIVATE(file);
     if (nvfp == NULL)
         return 0;
@@ -545,122 +623,81 @@ done:
     return rc;
 }
 
-static struct file_operations nv_procfs_registry_fops = {
+static const struct file_operations nv_procfs_registry_fops = {
     .open    = nv_procfs_open_registry,
+    .read    = seq_read,
+    .llseek  = seq_lseek,
+    .write   = nv_procfs_write_registry,
     .release = nv_procfs_close_registry,
 };
 
 static int
-nv_procfs_read_params(
-    char  *page,
-    char **start,
-    off_t  off,
-    int    count,
-    int   *eof,
-    void  *data
+nv_procfs_show_params(
+    struct seq_file *m,
+    void *v
 )
 {
     unsigned int i;
-    int len = 0;
     nv_parm_t *entry;
 
-    *eof = 1;
 
     for (i = 0; (entry = &nv_parms[i])->name != NULL; i++)
-        len += sprintf(page+len, "%s: %u\n", entry->name, *entry->data);
+        seq_printf(m, "%s: %u\n", entry->name, *entry->data);
 
-    len += sprintf(page+len, "RegistryDwords: \"%s\"\n",
+    seq_printf(m, "RegistryDwords: \"%s\"\n",
                 (NVreg_RegistryDwords != NULL) ? NVreg_RegistryDwords : "");
-    len += sprintf(page+len, "RmMsg: \"%s\"\n",
+    seq_printf(m, "RmMsg: \"%s\"\n",
                 (NVreg_RmMsg != NULL) ? NVreg_RmMsg : "");
 
-    return len;
+    return 0;
 }
 
 static int
-nv_procfs_read_registry(
-    char  *page,
-    char **start,
-    off_t  off,
-    int    count,
-    int   *eof,
-    void  *data
-)
+nv_procfs_open_params(
+    struct inode *inode,
+    struct file *file
+)    
 {
-    nv_state_t *nv = data;
-    nv_linux_state_t *nvl = NULL;
-    char *registry_keys;
+    return single_open(file, nv_procfs_show_params, NULL);
+}
 
-    if (nv != NULL)
-        nvl = NV_GET_NVL_FROM_NV_STATE(nv);
-    registry_keys = ((nvl != NULL) ?
-            nvl->registry_keys : nv_registry_keys);
+static const struct file_operations nv_procfs_params_fops = {
+    .owner   = THIS_MODULE,
+    .open    = nv_procfs_open_params,
+    .read    = seq_read,
+    .llseek  = seq_lseek,
+    .release = single_release,
+};
 
-    *eof = 1;
-    return sprintf(page, "Binary: \"%s\"\n", registry_keys);
-}
 
 static int
-nv_procfs_write_registry(
-    struct file   *file,
-    const char    *buffer,
-    unsigned long  count,
-    void          *data
+nv_procfs_show_text_file(
+    struct seq_file *m,
+    void *v
 )
 {
-    int status = 0;
-    nv_file_private_t *nvfp = NV_GET_FILE_PRIVATE(file);
-    char *proc_buffer;
-    unsigned long bytes_left;
-
-    down(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
+    seq_printf(m, "%s", (char *)m->private);
 
-    bytes_left = (NV_PROC_WRITE_BUFFER_SIZE - nvfp->off - 1);
-
-    if (count == 0)
-    {
-        status = -EINVAL;
-        goto done;
-    }
-    else if ((bytes_left == 0) || (count > bytes_left))
-    {
-        status = -ENOSPC;
-        goto done;
-    }
-
-    proc_buffer = &((char *)nvfp->data)[nvfp->off];
-
-    if (copy_from_user(proc_buffer, buffer, count))
-    {
-        nv_printf(NV_DBG_ERRORS, "NVRM: failed to copy in proc data!\n");
-        status = -EFAULT;
-    }
-    else
-    {
-        nvfp->proc_data = data;
-        nvfp->off += count;
-    }
-
-done:
-    up(&nvfp->fops_sp_lock[NV_FOPS_STACK_INDEX_PROCFS]);
-
-    return ((status < 0) ? status : (int)count);
+    return 0;
 }
 
 static int
-nv_procfs_read_text_file(
-    char  *page,
-    char **start,
-    off_t  off,
-    int    count,
-    int   *eof,
-    void  *data
+nv_procfs_open_text_file(
+    struct inode *inode,
+    struct file *file
 )
 {
-    *eof = 1;
-    return sprintf(page, "%s", (char *)data);
+    return single_open(file, nv_procfs_show_text_file, PDE_DATA(inode));
 }
 
+static const struct file_operations nv_procfs_text_fops = {
+    .owner   = THIS_MODULE,
+    .open    = nv_procfs_open_text_file,
+    .read    = seq_read,
+    .llseek  = seq_lseek,
+    .release = single_release,
+};
+
 static void
 nv_procfs_add_text_file(
     struct proc_dir_entry *parent,
@@ -668,22 +705,7 @@ nv_procfs_add_text_file(
     const char *text
 )
 {
-    NV_CREATE_PROC_FILE(filename, parent,
-            nv_procfs_read_text_file, NULL, NULL, (void *)text);
-}
-
-static void nv_procfs_unregister_all(struct proc_dir_entry *entry)
-{
-    while (entry)
-    {
-        struct proc_dir_entry *next = entry->next;
-        if (entry->subdir)
-            nv_procfs_unregister_all(entry->subdir);
-        remove_proc_entry(entry->name, entry->parent);
-        if (entry == proc_nvidia)
-            break;
-        entry = next;
-    }
+    proc_create_data(filename, NV_PROC_RO, parent, &nv_procfs_text_fops, (void *)text);
 }
 #endif
 
@@ -713,26 +735,11 @@ int nv_register_procfs(void)
     if (!proc_nvidia)
         goto failed;
 
-    entry = NV_CREATE_PROC_FILE("params", proc_nvidia,
-        nv_procfs_read_params, NULL, NULL, NULL);
+    entry = proc_create("params", NV_PROC_RO, proc_nvidia, &nv_procfs_params_fops);
     if (!entry)
         goto failed;
 
-    /*
-     * entry->proc_fops originally points to a constant
-     * structure, so to add more methods for the
-     * binary registry write path, we need to replace the
-     * said entry->proc_fops with a new fops structure.
-     * However, in preparation for this, we need to preserve
-     * the procfs read() and write() operations.
-     */
-    nv_procfs_registry_fops.read = entry->proc_fops->read;
-    nv_procfs_registry_fops.write = entry->proc_fops->write;
-
-    entry = NV_CREATE_PROC_FILE("registry", proc_nvidia,
-        nv_procfs_read_registry,
-        nv_procfs_write_registry,
-        &nv_procfs_registry_fops, NULL);
+    entry = proc_create("registry", NV_PROC_RW, proc_nvidia, &nv_procfs_registry_fops);
     if (!entry)
         goto failed;
 
@@ -753,8 +760,7 @@ int nv_register_procfs(void)
 
     nv_procfs_add_text_file(proc_nvidia_patches, "README", __README_patches);
 
-    entry = NV_CREATE_PROC_FILE("version", proc_nvidia,
-        nv_procfs_read_version, NULL, NULL, NULL);
+    entry = proc_create("version", NV_PROC_RO, proc_nvidia, &nv_procfs_version_fops);
     if (!entry)
         goto failed;
 
@@ -771,15 +777,11 @@ int nv_register_procfs(void)
         if (!proc_nvidia_gpu)
             goto failed;
 
-        entry = NV_CREATE_PROC_FILE("information", proc_nvidia_gpu,
-            nv_procfs_read_gpu_info, NULL, NULL, nv);
+	entry = proc_create_data("information", NV_PROC_RO, proc_nvidia_gpu, &nv_procfs_gpu_info_fops, nv);
         if (!entry)
             goto failed;
 
-        entry = NV_CREATE_PROC_FILE("registry", proc_nvidia_gpu,
-            nv_procfs_read_registry,
-            nv_procfs_write_registry,
-            &nv_procfs_registry_fops, nv);
+	entry = proc_create_data("registry", NV_PROC_RW, proc_nvidia_gpu, &nv_procfs_registry_fops, nv);
         if (!entry)
             goto failed;
 
@@ -789,18 +791,15 @@ int nv_register_procfs(void)
             if (!proc_nvidia_agp)
                 goto failed;
 
-            entry = NV_CREATE_PROC_FILE("status", proc_nvidia_agp,
-                nv_procfs_read_agp_status, NULL, NULL, nv);
+	    entry = proc_create("status", NV_PROC_RO, proc_nvidia_agp, &nv_procfs_read_agp_status);
             if (!entry)
                 goto failed;
 
-            entry = NV_CREATE_PROC_FILE("host-bridge", proc_nvidia_agp,
-                nv_procfs_read_agp_info, NULL, NULL, NULL);
+	    entry = proc_create("host-bridge", NV_PROC_RO, proc_nvidia_agp, &nv_procfs_read_agp_info);
             if (!entry)
                 goto failed;
 
-            entry = NV_CREATE_PROC_FILE("gpu", proc_nvidia_agp,
-                nv_procfs_read_agp_info, NULL, NULL, nv);
+	    entry = proc_create("gpu", NV_PROC_RO, proc_nvidia_agp, &nv_procfs_read_agp_info);
             if (!entry)
                 goto failed;
         }
@@ -809,7 +808,7 @@ int nv_register_procfs(void)
     return 0;
 #if defined(CONFIG_PROC_FS)
 failed:
-    nv_procfs_unregister_all(proc_nvidia);
+    remove_proc_subtree("nvidia", proc_nvidia);
     return -1;
 #endif
 }
@@ -817,6 +816,6 @@ failed:
 void nv_unregister_procfs(void)
 {
 #if defined(CONFIG_PROC_FS)
-    nv_procfs_unregister_all(proc_nvidia);
+    remove_proc_subtree("nvidia", proc_nvidia);
 #endif
 }