[ar7] fix proc filesystem usage, patch from Wipster.
[openwrt/svn-archive/archive.git] / package / ar7-atm / patches-D7.05.01.00 / 190-2.6.32_proc_fixes.patch
1 Index: sangam_atm-D7.05.01.00/tn7dsl.c
2 ===================================================================
3 --- sangam_atm-D7.05.01.00.orig/tn7dsl.c 2010-11-09 18:32:33.478706990 +0100
4 +++ sangam_atm-D7.05.01.00/tn7dsl.c 2010-11-09 18:32:33.488706997 +0100
5 @@ -215,7 +215,11 @@
6 static struct led_funcs ledreg[2];
7 #endif
8
9 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
10 #define DEV_DSLMOD CTL_UNNUMBERED
11 +#else
12 +#define DEV_DSLMOD 0
13 +#endif
14 #define MAX_STR_SIZE 256
15 #define DSL_MOD_SIZE 256
16
17 @@ -3615,9 +3619,16 @@
18 */
19 if(write)
20 {
21 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
22 ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
23 -
24 +#else
25 + ret = proc_dostring(ctl, write, buffer, lenp, 0);
26 +#endif
27 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
28 switch (ctl->ctl_name)
29 +#else
30 + switch ((long)ctl->extra2)
31 +#endif
32 {
33 case DEV_DSLMOD:
34 ptr = strpbrk(info, " \t");
35 @@ -3701,14 +3712,29 @@
36 else
37 {
38 len += sprintf(info+len, mod_req);
39 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
40 ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
41 +#else
42 + ret = proc_dostring(ctl, write, buffer, lenp, 0);
43 +#endif
44 }
45 return ret;
46 }
47
48
49 ctl_table dslmod_table[] = {
50 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
51 {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string}
52 +#else
53 + {
54 + .procname = "dslmod",
55 + .data = info,
56 + .maxlen = DSL_MOD_SIZE,
57 + .mode = 0644,
58 + .proc_handler = &dslmod_sysctl,
59 + .extra2 = (void *)DEV_DSLMOD,
60 + }
61 +#endif
62 ,
63 {0}
64 };
65 @@ -3716,7 +3742,16 @@
66 /* Make sure that /proc/sys/dev is there */
67 ctl_table dslmod_root_table[] = {
68 #ifdef CONFIG_PROC_FS
69 + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
70 {CTL_DEV, "dev", NULL, 0, 0555, dslmod_table}
71 + #else
72 + {
73 + .procname = "dev",
74 + .maxlen = 0,
75 + .mode = 0555,
76 + .child = dslmod_table,
77 + }
78 + #endif
79 ,
80 #endif /* CONFIG_PROC_FS */
81 {0}