190-2.6.32_proc_fixes.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. --- a/tn7dsl.c
  2. +++ b/tn7dsl.c
  3. @@ -203,7 +203,11 @@ led_reg_t ledreg[2];
  4. static struct led_funcs ledreg[2];
  5. #endif
  6. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
  7. #define DEV_DSLMOD CTL_UNNUMBERED
  8. +#else
  9. +#define DEV_DSLMOD 0
  10. +#endif
  11. #define MAX_STR_SIZE 256
  12. #define DSL_MOD_SIZE 256
  13. @@ -3431,9 +3435,16 @@ static int dslmod_sysctl(ctl_table *ctl,
  14. */
  15. if(write)
  16. {
  17. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
  18. ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
  19. -
  20. +#else
  21. + ret = proc_dostring(ctl, write, buffer, lenp, 0);
  22. +#endif
  23. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
  24. switch (ctl->ctl_name)
  25. +#else
  26. + switch ((long)ctl->extra2)
  27. +#endif
  28. {
  29. case DEV_DSLMOD:
  30. ptr = strpbrk(info, " \t");
  31. @@ -3517,14 +3528,29 @@ static int dslmod_sysctl(ctl_table *ctl,
  32. else
  33. {
  34. len += sprintf(info+len, mod_req);
  35. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
  36. ret = proc_dostring(ctl, write, filp, buffer, lenp, 0);
  37. +#else
  38. + ret = proc_dostring(ctl, write, buffer, lenp, 0);
  39. +#endif
  40. }
  41. return ret;
  42. }
  43. ctl_table dslmod_table[] = {
  44. +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
  45. {DEV_DSLMOD, "dslmod", info, DSL_MOD_SIZE, 0644, NULL, NULL, &dslmod_sysctl, &sysctl_string}
  46. +#else
  47. + {
  48. + .procname = "dslmod",
  49. + .data = info,
  50. + .maxlen = DSL_MOD_SIZE,
  51. + .mode = 0644,
  52. + .proc_handler = &dslmod_sysctl,
  53. + .extra2 = (void *)DEV_DSLMOD,
  54. + }
  55. +#endif
  56. ,
  57. {0}
  58. };
  59. @@ -3532,7 +3558,16 @@ ctl_table dslmod_table[] = {
  60. /* Make sure that /proc/sys/dev is there */
  61. ctl_table dslmod_root_table[] = {
  62. #ifdef CONFIG_PROC_FS
  63. + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
  64. {CTL_DEV, "dev", NULL, 0, 0555, dslmod_table}
  65. + #else
  66. + {
  67. + .procname = "dev",
  68. + .maxlen = 0,
  69. + .mode = 0555,
  70. + .child = dslmod_table,
  71. + }
  72. + #endif
  73. ,
  74. #endif /* CONFIG_PROC_FS */
  75. {0}