400-restore-old-debugfs_fops.patch 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. --- a/drivers/net/wireless/ath/carl9170/debug.c
  2. +++ b/drivers/net/wireless/ath/carl9170/debug.c
  3. @@ -54,6 +54,7 @@ struct carl9170_debugfs_fops {
  4. char *(*read)(struct ar9170 *ar, char *buf, size_t bufsize,
  5. ssize_t *len);
  6. ssize_t (*write)(struct ar9170 *aru, const char *buf, size_t size);
  7. + const struct file_operations fops;
  8. enum carl9170_device_state req_dev_state;
  9. };
  10. @@ -61,7 +62,7 @@ struct carl9170_debugfs_fops {
  11. static ssize_t carl9170_debugfs_read(struct file *file, char __user *userbuf,
  12. size_t count, loff_t *ppos)
  13. {
  14. - const struct carl9170_debugfs_fops *dfops;
  15. + struct carl9170_debugfs_fops *dfops;
  16. struct ar9170 *ar;
  17. char *buf = NULL, *res_buf = NULL;
  18. ssize_t ret = 0;
  19. @@ -74,7 +75,8 @@ static ssize_t carl9170_debugfs_read(str
  20. if (!ar)
  21. return -ENODEV;
  22. - dfops = debugfs_get_aux(file);
  23. + dfops = container_of(debugfs_real_fops(file),
  24. + struct carl9170_debugfs_fops, fops);
  25. if (!dfops->read)
  26. return -ENOSYS;
  27. @@ -111,7 +113,7 @@ out_free:
  28. static ssize_t carl9170_debugfs_write(struct file *file,
  29. const char __user *userbuf, size_t count, loff_t *ppos)
  30. {
  31. - const struct carl9170_debugfs_fops *dfops;
  32. + struct carl9170_debugfs_fops *dfops;
  33. struct ar9170 *ar;
  34. char *buf = NULL;
  35. int err = 0;
  36. @@ -126,7 +128,8 @@ static ssize_t carl9170_debugfs_write(st
  37. if (!ar)
  38. return -ENODEV;
  39. - dfops = debugfs_get_aux(file);
  40. + dfops = container_of(debugfs_real_fops(file),
  41. + struct carl9170_debugfs_fops, fops);
  42. if (!dfops->write)
  43. return -ENOSYS;
  44. @@ -162,11 +165,6 @@ out_free:
  45. return err;
  46. }
  47. -static struct debugfs_short_fops debugfs_fops = {
  48. - .read = carl9170_debugfs_read,
  49. - .write = carl9170_debugfs_write,
  50. -};
  51. -
  52. #define __DEBUGFS_DECLARE_FILE(name, _read, _write, _read_bufsize, \
  53. _attr, _dstate) \
  54. static const struct carl9170_debugfs_fops carl_debugfs_##name ##_ops = {\
  55. @@ -175,6 +173,12 @@ static const struct carl9170_debugfs_fop
  56. .write = _write, \
  57. .attr = _attr, \
  58. .req_dev_state = _dstate, \
  59. + .fops = { \
  60. + .open = simple_open, \
  61. + .read = carl9170_debugfs_read, \
  62. + .write = carl9170_debugfs_write, \
  63. + .owner = THIS_MODULE \
  64. + }, \
  65. }
  66. #define DEBUGFS_DECLARE_FILE(name, _read, _write, _read_bufsize, _attr) \
  67. @@ -812,9 +816,9 @@ void carl9170_debugfs_register(struct ar
  68. ar->hw->wiphy->debugfsdir);
  69. #define DEBUGFS_ADD(name) \
  70. - debugfs_create_file_aux(#name, carl_debugfs_##name ##_ops.attr, \
  71. - ar->debug_dir, ar, &carl_debugfs_##name ## _ops, \
  72. - &debugfs_fops)
  73. + debugfs_create_file(#name, carl_debugfs_##name ##_ops.attr, \
  74. + ar->debug_dir, ar, \
  75. + &carl_debugfs_##name ## _ops.fops)
  76. DEBUGFS_ADD(usb_tx_anch_urbs);
  77. DEBUGFS_ADD(usb_rx_pool_urbs);
  78. --- a/drivers/net/wireless/broadcom/b43/debugfs.c
  79. +++ b/drivers/net/wireless/broadcom/b43/debugfs.c
  80. @@ -30,6 +30,7 @@ static struct dentry *rootdir;
  81. struct b43_debugfs_fops {
  82. ssize_t (*read)(struct b43_wldev *dev, char *buf, size_t bufsize);
  83. int (*write)(struct b43_wldev *dev, const char *buf, size_t count);
  84. + struct file_operations fops;
  85. /* Offset of struct b43_dfs_file in struct b43_dfsentry */
  86. size_t file_struct_offset;
  87. };
  88. @@ -490,7 +491,7 @@ static ssize_t b43_debugfs_read(struct f
  89. size_t count, loff_t *ppos)
  90. {
  91. struct b43_wldev *dev;
  92. - const struct b43_debugfs_fops *dfops;
  93. + struct b43_debugfs_fops *dfops;
  94. struct b43_dfs_file *dfile;
  95. ssize_t ret;
  96. char *buf;
  97. @@ -510,7 +511,8 @@ static ssize_t b43_debugfs_read(struct f
  98. goto out_unlock;
  99. }
  100. - dfops = debugfs_get_aux(file);
  101. + dfops = container_of(debugfs_real_fops(file),
  102. + struct b43_debugfs_fops, fops);
  103. if (!dfops->read) {
  104. err = -ENOSYS;
  105. goto out_unlock;
  106. @@ -553,7 +555,7 @@ static ssize_t b43_debugfs_write(struct
  107. size_t count, loff_t *ppos)
  108. {
  109. struct b43_wldev *dev;
  110. - const struct b43_debugfs_fops *dfops;
  111. + struct b43_debugfs_fops *dfops;
  112. char *buf;
  113. int err = 0;
  114. @@ -571,7 +573,8 @@ static ssize_t b43_debugfs_write(struct
  115. goto out_unlock;
  116. }
  117. - dfops = debugfs_get_aux(file);
  118. + dfops = container_of(debugfs_real_fops(file),
  119. + struct b43_debugfs_fops, fops);
  120. if (!dfops->write) {
  121. err = -ENOSYS;
  122. goto out_unlock;
  123. @@ -599,16 +602,16 @@ out_unlock:
  124. }
  125. -static struct debugfs_short_fops debugfs_ops = {
  126. - .read = b43_debugfs_read,
  127. - .write = b43_debugfs_write,
  128. - .llseek = generic_file_llseek,
  129. -};
  130. -
  131. #define B43_DEBUGFS_FOPS(name, _read, _write) \
  132. static struct b43_debugfs_fops fops_##name = { \
  133. .read = _read, \
  134. .write = _write, \
  135. + .fops = { \
  136. + .open = simple_open, \
  137. + .read = b43_debugfs_read, \
  138. + .write = b43_debugfs_write, \
  139. + .llseek = generic_file_llseek, \
  140. + }, \
  141. .file_struct_offset = offsetof(struct b43_dfsentry, \
  142. file_##name), \
  143. }
  144. @@ -700,9 +703,9 @@ void b43_debugfs_add_device(struct b43_w
  145. #define ADD_FILE(name, mode) \
  146. do { \
  147. - debugfs_create_file_aux(__stringify(name), \
  148. + debugfs_create_file(__stringify(name), \
  149. mode, e->subdir, dev, \
  150. - &fops_##name, &debugfs_ops); \
  151. + &fops_##name.fops); \
  152. } while (0)
  153. --- a/drivers/net/wireless/broadcom/b43legacy/debugfs.c
  154. +++ b/drivers/net/wireless/broadcom/b43legacy/debugfs.c
  155. @@ -31,6 +31,7 @@ static struct dentry *rootdir;
  156. struct b43legacy_debugfs_fops {
  157. ssize_t (*read)(struct b43legacy_wldev *dev, char *buf, size_t bufsize);
  158. int (*write)(struct b43legacy_wldev *dev, const char *buf, size_t count);
  159. + struct file_operations fops;
  160. /* Offset of struct b43legacy_dfs_file in struct b43legacy_dfsentry */
  161. size_t file_struct_offset;
  162. /* Take wl->irq_lock before calling read/write? */
  163. @@ -187,7 +188,7 @@ static ssize_t b43legacy_debugfs_read(st
  164. size_t count, loff_t *ppos)
  165. {
  166. struct b43legacy_wldev *dev;
  167. - const struct b43legacy_debugfs_fops *dfops;
  168. + struct b43legacy_debugfs_fops *dfops;
  169. struct b43legacy_dfs_file *dfile;
  170. ssize_t ret;
  171. char *buf;
  172. @@ -207,7 +208,8 @@ static ssize_t b43legacy_debugfs_read(st
  173. goto out_unlock;
  174. }
  175. - dfops = debugfs_get_aux(file);
  176. + dfops = container_of(debugfs_real_fops(file),
  177. + struct b43legacy_debugfs_fops, fops);
  178. if (!dfops->read) {
  179. err = -ENOSYS;
  180. goto out_unlock;
  181. @@ -255,7 +257,7 @@ static ssize_t b43legacy_debugfs_write(s
  182. size_t count, loff_t *ppos)
  183. {
  184. struct b43legacy_wldev *dev;
  185. - const struct b43legacy_debugfs_fops *dfops;
  186. + struct b43legacy_debugfs_fops *dfops;
  187. char *buf;
  188. int err = 0;
  189. @@ -273,7 +275,8 @@ static ssize_t b43legacy_debugfs_write(s
  190. goto out_unlock;
  191. }
  192. - dfops = debugfs_get_aux(file);
  193. + dfops = container_of(debugfs_real_fops(file),
  194. + struct b43legacy_debugfs_fops, fops);
  195. if (!dfops->write) {
  196. err = -ENOSYS;
  197. goto out_unlock;
  198. @@ -305,16 +308,17 @@ out_unlock:
  199. return err ? err : count;
  200. }
  201. -static struct debugfs_short_fops debugfs_ops = {
  202. - .read = b43legacy_debugfs_read,
  203. - .write = b43legacy_debugfs_write,
  204. - .llseek = generic_file_llseek
  205. -};
  206. #define B43legacy_DEBUGFS_FOPS(name, _read, _write, _take_irqlock) \
  207. static struct b43legacy_debugfs_fops fops_##name = { \
  208. .read = _read, \
  209. .write = _write, \
  210. + .fops = { \
  211. + .open = simple_open, \
  212. + .read = b43legacy_debugfs_read, \
  213. + .write = b43legacy_debugfs_write, \
  214. + .llseek = generic_file_llseek, \
  215. + }, \
  216. .file_struct_offset = offsetof(struct b43legacy_dfsentry, \
  217. file_##name), \
  218. .take_irqlock = _take_irqlock, \
  219. @@ -382,9 +386,9 @@ void b43legacy_debugfs_add_device(struct
  220. #define ADD_FILE(name, mode) \
  221. do { \
  222. - debugfs_create_file_aux(__stringify(name), mode, \
  223. + debugfs_create_file(__stringify(name), mode, \
  224. e->subdir, dev, \
  225. - &fops_##name, &debugfs_ops); \
  226. + &fops_##name.fops); \
  227. } while (0)