diff options
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r-- | drivers/bluetooth/btmrvl_debugfs.c | 249 |
1 files changed, 106 insertions, 143 deletions
diff --git a/drivers/bluetooth/btmrvl_debugfs.c b/drivers/bluetooth/btmrvl_debugfs.c index 747bb0c723c3..4617bd12f63b 100644 --- a/drivers/bluetooth/btmrvl_debugfs.c +++ b/drivers/bluetooth/btmrvl_debugfs.c | |||
@@ -51,20 +51,15 @@ static int btmrvl_open_generic(struct inode *inode, struct file *file) | |||
51 | } | 51 | } |
52 | 52 | ||
53 | static ssize_t btmrvl_hscfgcmd_write(struct file *file, | 53 | static ssize_t btmrvl_hscfgcmd_write(struct file *file, |
54 | const char __user *ubuf, | 54 | const char __user *ubuf, size_t count, loff_t *ppos) |
55 | size_t count, | ||
56 | loff_t *ppos) | ||
57 | { | 55 | { |
58 | struct btmrvl_private *priv = | 56 | struct btmrvl_private *priv = file->private_data; |
59 | (struct btmrvl_private *) file->private_data; | ||
60 | |||
61 | long result, ret; | ||
62 | char buf[16]; | 57 | char buf[16]; |
58 | long result, ret; | ||
63 | 59 | ||
64 | memset(buf, 0, sizeof(buf)); | 60 | memset(buf, 0, sizeof(buf)); |
65 | 61 | ||
66 | if (copy_from_user(&buf, ubuf, | 62 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
67 | min_t(size_t, sizeof(buf) - 1, count))) | ||
68 | return -EFAULT; | 63 | return -EFAULT; |
69 | 64 | ||
70 | ret = strict_strtol(buf, 10, &result); | 65 | ret = strict_strtol(buf, 10, &result); |
@@ -79,38 +74,35 @@ static ssize_t btmrvl_hscfgcmd_write(struct file *file, | |||
79 | return count; | 74 | return count; |
80 | } | 75 | } |
81 | 76 | ||
82 | static ssize_t btmrvl_hscfgcmd_read(struct file *file, char __user * userbuf, | 77 | static ssize_t btmrvl_hscfgcmd_read(struct file *file, char __user *userbuf, |
83 | size_t count, loff_t *ppos) | 78 | size_t count, loff_t *ppos) |
84 | { | 79 | { |
85 | struct btmrvl_private *priv = | 80 | struct btmrvl_private *priv = file->private_data; |
86 | (struct btmrvl_private *) file->private_data; | ||
87 | int ret; | ||
88 | char buf[16]; | 81 | char buf[16]; |
82 | int ret; | ||
89 | 83 | ||
90 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", | 84 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", |
91 | priv->btmrvl_dev.hscfgcmd); | 85 | priv->btmrvl_dev.hscfgcmd); |
92 | 86 | ||
93 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); | 87 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); |
94 | } | 88 | } |
95 | 89 | ||
96 | static const struct file_operations btmrvl_hscfgcmd_fops = { | 90 | static const struct file_operations btmrvl_hscfgcmd_fops = { |
97 | .read = btmrvl_hscfgcmd_read, | 91 | .read = btmrvl_hscfgcmd_read, |
98 | .write = btmrvl_hscfgcmd_write, | 92 | .write = btmrvl_hscfgcmd_write, |
99 | .open = btmrvl_open_generic, | 93 | .open = btmrvl_open_generic, |
100 | }; | 94 | }; |
101 | 95 | ||
102 | static ssize_t btmrvl_psmode_write(struct file *file, const char __user *ubuf, | 96 | static ssize_t btmrvl_psmode_write(struct file *file, const char __user *ubuf, |
103 | size_t count, loff_t *ppos) | 97 | size_t count, loff_t *ppos) |
104 | { | 98 | { |
105 | struct btmrvl_private *priv = | 99 | struct btmrvl_private *priv = file->private_data; |
106 | (struct btmrvl_private *) file->private_data; | ||
107 | long result, ret; | ||
108 | char buf[16]; | 100 | char buf[16]; |
101 | long result, ret; | ||
109 | 102 | ||
110 | memset(buf, 0, sizeof(buf)); | 103 | memset(buf, 0, sizeof(buf)); |
111 | 104 | ||
112 | if (copy_from_user(&buf, ubuf, | 105 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
113 | min_t(size_t, sizeof(buf) - 1, count))) | ||
114 | return -EFAULT; | 106 | return -EFAULT; |
115 | 107 | ||
116 | ret = strict_strtol(buf, 10, &result); | 108 | ret = strict_strtol(buf, 10, &result); |
@@ -120,38 +112,35 @@ static ssize_t btmrvl_psmode_write(struct file *file, const char __user *ubuf, | |||
120 | return count; | 112 | return count; |
121 | } | 113 | } |
122 | 114 | ||
123 | static ssize_t btmrvl_psmode_read(struct file *file, char __user * userbuf, | 115 | static ssize_t btmrvl_psmode_read(struct file *file, char __user *userbuf, |
124 | size_t count, loff_t *ppos) | 116 | size_t count, loff_t *ppos) |
125 | { | 117 | { |
126 | struct btmrvl_private *priv = | 118 | struct btmrvl_private *priv = file->private_data; |
127 | (struct btmrvl_private *) file->private_data; | ||
128 | int ret; | ||
129 | char buf[16]; | 119 | char buf[16]; |
120 | int ret; | ||
130 | 121 | ||
131 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", | 122 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", |
132 | priv->btmrvl_dev.psmode); | 123 | priv->btmrvl_dev.psmode); |
133 | 124 | ||
134 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); | 125 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); |
135 | } | 126 | } |
136 | 127 | ||
137 | static const struct file_operations btmrvl_psmode_fops = { | 128 | static const struct file_operations btmrvl_psmode_fops = { |
138 | .read = btmrvl_psmode_read, | 129 | .read = btmrvl_psmode_read, |
139 | .write = btmrvl_psmode_write, | 130 | .write = btmrvl_psmode_write, |
140 | .open = btmrvl_open_generic, | 131 | .open = btmrvl_open_generic, |
141 | }; | 132 | }; |
142 | 133 | ||
143 | static ssize_t btmrvl_pscmd_write(struct file *file, const char __user *ubuf, | 134 | static ssize_t btmrvl_pscmd_write(struct file *file, const char __user *ubuf, |
144 | size_t count, loff_t *ppos) | 135 | size_t count, loff_t *ppos) |
145 | { | 136 | { |
146 | struct btmrvl_private *priv = | 137 | struct btmrvl_private *priv = file->private_data; |
147 | (struct btmrvl_private *) file->private_data; | ||
148 | long result, ret; | ||
149 | char buf[16]; | 138 | char buf[16]; |
139 | long result, ret; | ||
150 | 140 | ||
151 | memset(buf, 0, sizeof(buf)); | 141 | memset(buf, 0, sizeof(buf)); |
152 | 142 | ||
153 | if (copy_from_user(&buf, ubuf, | 143 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
154 | min_t(size_t, sizeof(buf) - 1, count))) | ||
155 | return -EFAULT; | 144 | return -EFAULT; |
156 | 145 | ||
157 | ret = strict_strtol(buf, 10, &result); | 146 | ret = strict_strtol(buf, 10, &result); |
@@ -167,13 +156,12 @@ static ssize_t btmrvl_pscmd_write(struct file *file, const char __user *ubuf, | |||
167 | 156 | ||
168 | } | 157 | } |
169 | 158 | ||
170 | static ssize_t btmrvl_pscmd_read(struct file *file, char __user * userbuf, | 159 | static ssize_t btmrvl_pscmd_read(struct file *file, char __user *userbuf, |
171 | size_t count, loff_t *ppos) | 160 | size_t count, loff_t *ppos) |
172 | { | 161 | { |
173 | struct btmrvl_private *priv = | 162 | struct btmrvl_private *priv = file->private_data; |
174 | (struct btmrvl_private *) file->private_data; | ||
175 | int ret; | ||
176 | char buf[16]; | 163 | char buf[16]; |
164 | int ret; | ||
177 | 165 | ||
178 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.pscmd); | 166 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.pscmd); |
179 | 167 | ||
@@ -187,17 +175,15 @@ static const struct file_operations btmrvl_pscmd_fops = { | |||
187 | }; | 175 | }; |
188 | 176 | ||
189 | static ssize_t btmrvl_gpiogap_write(struct file *file, const char __user *ubuf, | 177 | static ssize_t btmrvl_gpiogap_write(struct file *file, const char __user *ubuf, |
190 | size_t count, loff_t *ppos) | 178 | size_t count, loff_t *ppos) |
191 | { | 179 | { |
192 | struct btmrvl_private *priv = | 180 | struct btmrvl_private *priv = file->private_data; |
193 | (struct btmrvl_private *) file->private_data; | ||
194 | long result, ret; | ||
195 | char buf[16]; | 181 | char buf[16]; |
182 | long result, ret; | ||
196 | 183 | ||
197 | memset(buf, 0, sizeof(buf)); | 184 | memset(buf, 0, sizeof(buf)); |
198 | 185 | ||
199 | if (copy_from_user(&buf, ubuf, | 186 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
200 | min_t(size_t, sizeof(buf) - 1, count))) | ||
201 | return -EFAULT; | 187 | return -EFAULT; |
202 | 188 | ||
203 | ret = strict_strtol(buf, 16, &result); | 189 | ret = strict_strtol(buf, 16, &result); |
@@ -207,38 +193,35 @@ static ssize_t btmrvl_gpiogap_write(struct file *file, const char __user *ubuf, | |||
207 | return count; | 193 | return count; |
208 | } | 194 | } |
209 | 195 | ||
210 | static ssize_t btmrvl_gpiogap_read(struct file *file, char __user * userbuf, | 196 | static ssize_t btmrvl_gpiogap_read(struct file *file, char __user *userbuf, |
211 | size_t count, loff_t *ppos) | 197 | size_t count, loff_t *ppos) |
212 | { | 198 | { |
213 | struct btmrvl_private *priv = | 199 | struct btmrvl_private *priv = file->private_data; |
214 | (struct btmrvl_private *) file->private_data; | ||
215 | int ret; | ||
216 | char buf[16]; | 200 | char buf[16]; |
201 | int ret; | ||
217 | 202 | ||
218 | ret = snprintf(buf, sizeof(buf) - 1, "0x%x\n", | 203 | ret = snprintf(buf, sizeof(buf) - 1, "0x%x\n", |
219 | priv->btmrvl_dev.gpio_gap); | 204 | priv->btmrvl_dev.gpio_gap); |
220 | 205 | ||
221 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); | 206 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); |
222 | } | 207 | } |
223 | 208 | ||
224 | static const struct file_operations btmrvl_gpiogap_fops = { | 209 | static const struct file_operations btmrvl_gpiogap_fops = { |
225 | .read = btmrvl_gpiogap_read, | 210 | .read = btmrvl_gpiogap_read, |
226 | .write = btmrvl_gpiogap_write, | 211 | .write = btmrvl_gpiogap_write, |
227 | .open = btmrvl_open_generic, | 212 | .open = btmrvl_open_generic, |
228 | }; | 213 | }; |
229 | 214 | ||
230 | static ssize_t btmrvl_hscmd_write(struct file *file, const char __user *ubuf, | 215 | static ssize_t btmrvl_hscmd_write(struct file *file, const char __user *ubuf, |
231 | size_t count, loff_t *ppos) | 216 | size_t count, loff_t *ppos) |
232 | { | 217 | { |
233 | struct btmrvl_private *priv = | 218 | struct btmrvl_private *priv = (struct btmrvl_private *) file->private_data; |
234 | (struct btmrvl_private *) file->private_data; | ||
235 | long result, ret; | ||
236 | char buf[16]; | 219 | char buf[16]; |
220 | long result, ret; | ||
237 | 221 | ||
238 | memset(buf, 0, sizeof(buf)); | 222 | memset(buf, 0, sizeof(buf)); |
239 | 223 | ||
240 | if (copy_from_user(&buf, ubuf, | 224 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
241 | min_t(size_t, sizeof(buf) - 1, count))) | ||
242 | return -EFAULT; | 225 | return -EFAULT; |
243 | 226 | ||
244 | ret = strict_strtol(buf, 10, &result); | 227 | ret = strict_strtol(buf, 10, &result); |
@@ -252,13 +235,12 @@ static ssize_t btmrvl_hscmd_write(struct file *file, const char __user *ubuf, | |||
252 | return count; | 235 | return count; |
253 | } | 236 | } |
254 | 237 | ||
255 | static ssize_t btmrvl_hscmd_read(struct file *file, char __user * userbuf, | 238 | static ssize_t btmrvl_hscmd_read(struct file *file, char __user *userbuf, |
256 | size_t count, loff_t *ppos) | 239 | size_t count, loff_t *ppos) |
257 | { | 240 | { |
258 | struct btmrvl_private *priv = | 241 | struct btmrvl_private *priv = file->private_data; |
259 | (struct btmrvl_private *) file->private_data; | ||
260 | int ret; | ||
261 | char buf[16]; | 242 | char buf[16]; |
243 | int ret; | ||
262 | 244 | ||
263 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.hscmd); | 245 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.hscmd); |
264 | 246 | ||
@@ -266,23 +248,21 @@ static ssize_t btmrvl_hscmd_read(struct file *file, char __user * userbuf, | |||
266 | } | 248 | } |
267 | 249 | ||
268 | static const struct file_operations btmrvl_hscmd_fops = { | 250 | static const struct file_operations btmrvl_hscmd_fops = { |
269 | .read = btmrvl_hscmd_read, | 251 | .read = btmrvl_hscmd_read, |
270 | .write = btmrvl_hscmd_write, | 252 | .write = btmrvl_hscmd_write, |
271 | .open = btmrvl_open_generic, | 253 | .open = btmrvl_open_generic, |
272 | }; | 254 | }; |
273 | 255 | ||
274 | static ssize_t btmrvl_hsmode_write(struct file *file, const char __user *ubuf, | 256 | static ssize_t btmrvl_hsmode_write(struct file *file, const char __user *ubuf, |
275 | size_t count, loff_t *ppos) | 257 | size_t count, loff_t *ppos) |
276 | { | 258 | { |
277 | struct btmrvl_private *priv = | 259 | struct btmrvl_private *priv = file->private_data; |
278 | (struct btmrvl_private *) file->private_data; | ||
279 | long result, ret; | ||
280 | char buf[16]; | 260 | char buf[16]; |
261 | long result, ret; | ||
281 | 262 | ||
282 | memset(buf, 0, sizeof(buf)); | 263 | memset(buf, 0, sizeof(buf)); |
283 | 264 | ||
284 | if (copy_from_user(&buf, ubuf, | 265 | if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count))) |
285 | min_t(size_t, sizeof(buf) - 1, count))) | ||
286 | return -EFAULT; | 266 | return -EFAULT; |
287 | 267 | ||
288 | ret = strict_strtol(buf, 10, &result); | 268 | ret = strict_strtol(buf, 10, &result); |
@@ -293,32 +273,29 @@ static ssize_t btmrvl_hsmode_write(struct file *file, const char __user *ubuf, | |||
293 | } | 273 | } |
294 | 274 | ||
295 | static ssize_t btmrvl_hsmode_read(struct file *file, char __user * userbuf, | 275 | static ssize_t btmrvl_hsmode_read(struct file *file, char __user * userbuf, |
296 | size_t count, loff_t *ppos) | 276 | size_t count, loff_t *ppos) |
297 | { | 277 | { |
298 | struct btmrvl_private *priv = | 278 | struct btmrvl_private *priv = file->private_data; |
299 | (struct btmrvl_private *) file->private_data; | ||
300 | int ret; | ||
301 | char buf[16]; | 279 | char buf[16]; |
280 | int ret; | ||
302 | 281 | ||
303 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", | 282 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.hsmode); |
304 | priv->btmrvl_dev.hsmode); | ||
305 | 283 | ||
306 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); | 284 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); |
307 | } | 285 | } |
308 | 286 | ||
309 | static const struct file_operations btmrvl_hsmode_fops = { | 287 | static const struct file_operations btmrvl_hsmode_fops = { |
310 | .read = btmrvl_hsmode_read, | 288 | .read = btmrvl_hsmode_read, |
311 | .write = btmrvl_hsmode_write, | 289 | .write = btmrvl_hsmode_write, |
312 | .open = btmrvl_open_generic, | 290 | .open = btmrvl_open_generic, |
313 | }; | 291 | }; |
314 | 292 | ||
315 | static ssize_t btmrvl_curpsmode_read(struct file *file, char __user * userbuf, | 293 | static ssize_t btmrvl_curpsmode_read(struct file *file, char __user *userbuf, |
316 | size_t count, loff_t *ppos) | 294 | size_t count, loff_t *ppos) |
317 | { | 295 | { |
318 | struct btmrvl_private *priv = | 296 | struct btmrvl_private *priv = file->private_data; |
319 | (struct btmrvl_private *) file->private_data; | ||
320 | int ret; | ||
321 | char buf[16]; | 297 | char buf[16]; |
298 | int ret; | ||
322 | 299 | ||
323 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->adapter->psmode); | 300 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->adapter->psmode); |
324 | 301 | ||
@@ -326,71 +303,65 @@ static ssize_t btmrvl_curpsmode_read(struct file *file, char __user * userbuf, | |||
326 | } | 303 | } |
327 | 304 | ||
328 | static const struct file_operations btmrvl_curpsmode_fops = { | 305 | static const struct file_operations btmrvl_curpsmode_fops = { |
329 | .read = btmrvl_curpsmode_read, | 306 | .read = btmrvl_curpsmode_read, |
330 | .open = btmrvl_open_generic, | 307 | .open = btmrvl_open_generic, |
331 | }; | 308 | }; |
332 | 309 | ||
333 | static ssize_t btmrvl_psstate_read(struct file *file, char __user * userbuf, | 310 | static ssize_t btmrvl_psstate_read(struct file *file, char __user * userbuf, |
334 | size_t count, loff_t *ppos) | 311 | size_t count, loff_t *ppos) |
335 | { | 312 | { |
336 | struct btmrvl_private *priv = | 313 | struct btmrvl_private *priv = file->private_data; |
337 | (struct btmrvl_private *) file->private_data; | ||
338 | int ret; | ||
339 | char buf[16]; | 314 | char buf[16]; |
315 | int ret; | ||
340 | 316 | ||
341 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", | 317 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->adapter->ps_state); |
342 | priv->adapter->ps_state); | ||
343 | 318 | ||
344 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); | 319 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); |
345 | } | 320 | } |
346 | 321 | ||
347 | static const struct file_operations btmrvl_psstate_fops = { | 322 | static const struct file_operations btmrvl_psstate_fops = { |
348 | .read = btmrvl_psstate_read, | 323 | .read = btmrvl_psstate_read, |
349 | .open = btmrvl_open_generic, | 324 | .open = btmrvl_open_generic, |
350 | }; | 325 | }; |
351 | 326 | ||
352 | static ssize_t btmrvl_hsstate_read(struct file *file, char __user * userbuf, | 327 | static ssize_t btmrvl_hsstate_read(struct file *file, char __user *userbuf, |
353 | size_t count, loff_t *ppos) | 328 | size_t count, loff_t *ppos) |
354 | { | 329 | { |
355 | struct btmrvl_private *priv = | 330 | struct btmrvl_private *priv = file->private_data; |
356 | (struct btmrvl_private *) file->private_data; | ||
357 | int ret; | ||
358 | char buf[16]; | 331 | char buf[16]; |
332 | int ret; | ||
359 | 333 | ||
360 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", | 334 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->adapter->hs_state); |
361 | priv->adapter->hs_state); | ||
362 | 335 | ||
363 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); | 336 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); |
364 | } | 337 | } |
365 | 338 | ||
366 | static const struct file_operations btmrvl_hsstate_fops = { | 339 | static const struct file_operations btmrvl_hsstate_fops = { |
367 | .read = btmrvl_hsstate_read, | 340 | .read = btmrvl_hsstate_read, |
368 | .open = btmrvl_open_generic, | 341 | .open = btmrvl_open_generic, |
369 | }; | 342 | }; |
370 | 343 | ||
371 | static ssize_t btmrvl_txdnldready_read(struct file *file, char __user * userbuf, | 344 | static ssize_t btmrvl_txdnldready_read(struct file *file, char __user *userbuf, |
372 | size_t count, loff_t *ppos) | 345 | size_t count, loff_t *ppos) |
373 | { | 346 | { |
374 | struct btmrvl_private *priv = | 347 | struct btmrvl_private *priv = file->private_data; |
375 | (struct btmrvl_private *) file->private_data; | ||
376 | int ret; | ||
377 | char buf[16]; | 348 | char buf[16]; |
349 | int ret; | ||
378 | 350 | ||
379 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", | 351 | ret = snprintf(buf, sizeof(buf) - 1, "%d\n", |
380 | priv->btmrvl_dev.tx_dnld_rdy); | 352 | priv->btmrvl_dev.tx_dnld_rdy); |
381 | 353 | ||
382 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); | 354 | return simple_read_from_buffer(userbuf, count, ppos, buf, ret); |
383 | } | 355 | } |
384 | 356 | ||
385 | static const struct file_operations btmrvl_txdnldready_fops = { | 357 | static const struct file_operations btmrvl_txdnldready_fops = { |
386 | .read = btmrvl_txdnldready_read, | 358 | .read = btmrvl_txdnldready_read, |
387 | .open = btmrvl_open_generic, | 359 | .open = btmrvl_open_generic, |
388 | }; | 360 | }; |
389 | 361 | ||
390 | void btmrvl_debugfs_init(struct hci_dev *hdev) | 362 | void btmrvl_debugfs_init(struct hci_dev *hdev) |
391 | { | 363 | { |
392 | struct btmrvl_private *priv = | 364 | struct btmrvl_private *priv = hdev->driver_data; |
393 | (struct btmrvl_private *) hdev->driver_data; | ||
394 | struct btmrvl_debugfs_data *dbg; | 365 | struct btmrvl_debugfs_data *dbg; |
395 | 366 | ||
396 | dbg = kzalloc(sizeof(*dbg), GFP_KERNEL); | 367 | dbg = kzalloc(sizeof(*dbg), GFP_KERNEL); |
@@ -406,22 +377,16 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) | |||
406 | dbg->config_dir = debugfs_create_dir("config", dbg->root_dir); | 377 | dbg->config_dir = debugfs_create_dir("config", dbg->root_dir); |
407 | 378 | ||
408 | dbg->psmode = debugfs_create_file("psmode", 0644, dbg->config_dir, | 379 | dbg->psmode = debugfs_create_file("psmode", 0644, dbg->config_dir, |
409 | hdev->driver_data, | 380 | hdev->driver_data, &btmrvl_psmode_fops); |
410 | &btmrvl_psmode_fops); | 381 | dbg->pscmd = debugfs_create_file("pscmd", 0644, dbg->config_dir, |
411 | dbg->pscmd = | ||
412 | debugfs_create_file("pscmd", 0644, dbg->config_dir, | ||
413 | hdev->driver_data, &btmrvl_pscmd_fops); | 382 | hdev->driver_data, &btmrvl_pscmd_fops); |
414 | dbg->gpiogap = | 383 | dbg->gpiogap = debugfs_create_file("gpiogap", 0644, dbg->config_dir, |
415 | debugfs_create_file("gpiogap", 0644, dbg->config_dir, | ||
416 | hdev->driver_data, &btmrvl_gpiogap_fops); | 384 | hdev->driver_data, &btmrvl_gpiogap_fops); |
417 | dbg->hsmode = | 385 | dbg->hsmode = debugfs_create_file("hsmode", 0644, dbg->config_dir, |
418 | debugfs_create_file("hsmode", 0644, dbg->config_dir, | ||
419 | hdev->driver_data, &btmrvl_hsmode_fops); | 386 | hdev->driver_data, &btmrvl_hsmode_fops); |
420 | dbg->hscmd = | 387 | dbg->hscmd = debugfs_create_file("hscmd", 0644, dbg->config_dir, |
421 | debugfs_create_file("hscmd", 0644, dbg->config_dir, | ||
422 | hdev->driver_data, &btmrvl_hscmd_fops); | 388 | hdev->driver_data, &btmrvl_hscmd_fops); |
423 | dbg->hscfgcmd = | 389 | dbg->hscfgcmd = debugfs_create_file("hscfgcmd", 0644, dbg->config_dir, |
424 | debugfs_create_file("hscfgcmd", 0644, dbg->config_dir, | ||
425 | hdev->driver_data, &btmrvl_hscfgcmd_fops); | 390 | hdev->driver_data, &btmrvl_hscfgcmd_fops); |
426 | 391 | ||
427 | dbg->status_dir = debugfs_create_dir("status", dbg->root_dir); | 392 | dbg->status_dir = debugfs_create_dir("status", dbg->root_dir); |
@@ -429,21 +394,19 @@ void btmrvl_debugfs_init(struct hci_dev *hdev) | |||
429 | dbg->status_dir, | 394 | dbg->status_dir, |
430 | hdev->driver_data, | 395 | hdev->driver_data, |
431 | &btmrvl_curpsmode_fops); | 396 | &btmrvl_curpsmode_fops); |
432 | dbg->psstate = | 397 | dbg->psstate = debugfs_create_file("psstate", 0444, dbg->status_dir, |
433 | debugfs_create_file("psstate", 0444, dbg->status_dir, | ||
434 | hdev->driver_data, &btmrvl_psstate_fops); | 398 | hdev->driver_data, &btmrvl_psstate_fops); |
435 | dbg->hsstate = | 399 | dbg->hsstate = debugfs_create_file("hsstate", 0444, dbg->status_dir, |
436 | debugfs_create_file("hsstate", 0444, dbg->status_dir, | ||
437 | hdev->driver_data, &btmrvl_hsstate_fops); | 400 | hdev->driver_data, &btmrvl_hsstate_fops); |
438 | dbg->txdnldready = | 401 | dbg->txdnldready = debugfs_create_file("txdnldready", 0444, |
439 | debugfs_create_file("txdnldready", 0444, dbg->status_dir, | 402 | dbg->status_dir, |
440 | hdev->driver_data, &btmrvl_txdnldready_fops); | 403 | hdev->driver_data, |
404 | &btmrvl_txdnldready_fops); | ||
441 | } | 405 | } |
442 | 406 | ||
443 | void btmrvl_debugfs_remove(struct hci_dev *hdev) | 407 | void btmrvl_debugfs_remove(struct hci_dev *hdev) |
444 | { | 408 | { |
445 | struct btmrvl_private *priv = | 409 | struct btmrvl_private *priv = hdev->driver_data; |
446 | (struct btmrvl_private *) hdev->driver_data; | ||
447 | struct btmrvl_debugfs_data *dbg = priv->debugfs_data; | 410 | struct btmrvl_debugfs_data *dbg = priv->debugfs_data; |
448 | 411 | ||
449 | if (!dbg) | 412 | if (!dbg) |