diff options
Diffstat (limited to 'drivers/net/wireless/wl12xx/debugfs.c')
-rw-r--r-- | drivers/net/wireless/wl12xx/debugfs.c | 51 |
1 files changed, 20 insertions, 31 deletions
diff --git a/drivers/net/wireless/wl12xx/debugfs.c b/drivers/net/wireless/wl12xx/debugfs.c index ec6077760157..8e75b09723b9 100644 --- a/drivers/net/wireless/wl12xx/debugfs.c +++ b/drivers/net/wireless/wl12xx/debugfs.c | |||
@@ -99,7 +99,7 @@ static void wl1271_debugfs_update_stats(struct wl1271 *wl) | |||
99 | 99 | ||
100 | mutex_lock(&wl->mutex); | 100 | mutex_lock(&wl->mutex); |
101 | 101 | ||
102 | ret = wl1271_ps_elp_wakeup(wl, false); | 102 | ret = wl1271_ps_elp_wakeup(wl); |
103 | if (ret < 0) | 103 | if (ret < 0) |
104 | goto out; | 104 | goto out; |
105 | 105 | ||
@@ -261,27 +261,25 @@ static ssize_t gpio_power_write(struct file *file, | |||
261 | unsigned long value; | 261 | unsigned long value; |
262 | int ret; | 262 | int ret; |
263 | 263 | ||
264 | mutex_lock(&wl->mutex); | ||
265 | |||
266 | len = min(count, sizeof(buf) - 1); | 264 | len = min(count, sizeof(buf) - 1); |
267 | if (copy_from_user(buf, user_buf, len)) { | 265 | if (copy_from_user(buf, user_buf, len)) { |
268 | ret = -EFAULT; | 266 | return -EFAULT; |
269 | goto out; | ||
270 | } | 267 | } |
271 | buf[len] = '\0'; | 268 | buf[len] = '\0'; |
272 | 269 | ||
273 | ret = strict_strtoul(buf, 0, &value); | 270 | ret = strict_strtoul(buf, 0, &value); |
274 | if (ret < 0) { | 271 | if (ret < 0) { |
275 | wl1271_warning("illegal value in gpio_power"); | 272 | wl1271_warning("illegal value in gpio_power"); |
276 | goto out; | 273 | return -EINVAL; |
277 | } | 274 | } |
278 | 275 | ||
276 | mutex_lock(&wl->mutex); | ||
277 | |||
279 | if (value) | 278 | if (value) |
280 | wl1271_power_on(wl); | 279 | wl1271_power_on(wl); |
281 | else | 280 | else |
282 | wl1271_power_off(wl); | 281 | wl1271_power_off(wl); |
283 | 282 | ||
284 | out: | ||
285 | mutex_unlock(&wl->mutex); | 283 | mutex_unlock(&wl->mutex); |
286 | return count; | 284 | return count; |
287 | } | 285 | } |
@@ -293,12 +291,13 @@ static const struct file_operations gpio_power_ops = { | |||
293 | .llseek = default_llseek, | 291 | .llseek = default_llseek, |
294 | }; | 292 | }; |
295 | 293 | ||
296 | static int wl1271_debugfs_add_files(struct wl1271 *wl) | 294 | static int wl1271_debugfs_add_files(struct wl1271 *wl, |
295 | struct dentry *rootdir) | ||
297 | { | 296 | { |
298 | int ret = 0; | 297 | int ret = 0; |
299 | struct dentry *entry, *stats; | 298 | struct dentry *entry, *stats; |
300 | 299 | ||
301 | stats = debugfs_create_dir("fw-statistics", wl->rootdir); | 300 | stats = debugfs_create_dir("fw-statistics", rootdir); |
302 | if (!stats || IS_ERR(stats)) { | 301 | if (!stats || IS_ERR(stats)) { |
303 | entry = stats; | 302 | entry = stats; |
304 | goto err; | 303 | goto err; |
@@ -395,16 +394,11 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl) | |||
395 | DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data); | 394 | DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data); |
396 | DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data); | 395 | DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data); |
397 | 396 | ||
398 | DEBUGFS_ADD(tx_queue_len, wl->rootdir); | 397 | DEBUGFS_ADD(tx_queue_len, rootdir); |
399 | DEBUGFS_ADD(retry_count, wl->rootdir); | 398 | DEBUGFS_ADD(retry_count, rootdir); |
400 | DEBUGFS_ADD(excessive_retries, wl->rootdir); | 399 | DEBUGFS_ADD(excessive_retries, rootdir); |
401 | |||
402 | DEBUGFS_ADD(gpio_power, wl->rootdir); | ||
403 | 400 | ||
404 | entry = debugfs_create_x32("debug_level", 0600, wl->rootdir, | 401 | DEBUGFS_ADD(gpio_power, rootdir); |
405 | &wl12xx_debug_level); | ||
406 | if (!entry || IS_ERR(entry)) | ||
407 | goto err; | ||
408 | 402 | ||
409 | return 0; | 403 | return 0; |
410 | 404 | ||
@@ -419,7 +413,7 @@ err: | |||
419 | 413 | ||
420 | void wl1271_debugfs_reset(struct wl1271 *wl) | 414 | void wl1271_debugfs_reset(struct wl1271 *wl) |
421 | { | 415 | { |
422 | if (!wl->rootdir) | 416 | if (!wl->stats.fw_stats) |
423 | return; | 417 | return; |
424 | 418 | ||
425 | memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats)); | 419 | memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats)); |
@@ -430,13 +424,13 @@ void wl1271_debugfs_reset(struct wl1271 *wl) | |||
430 | int wl1271_debugfs_init(struct wl1271 *wl) | 424 | int wl1271_debugfs_init(struct wl1271 *wl) |
431 | { | 425 | { |
432 | int ret; | 426 | int ret; |
427 | struct dentry *rootdir; | ||
433 | 428 | ||
434 | wl->rootdir = debugfs_create_dir(KBUILD_MODNAME, | 429 | rootdir = debugfs_create_dir(KBUILD_MODNAME, |
435 | wl->hw->wiphy->debugfsdir); | 430 | wl->hw->wiphy->debugfsdir); |
436 | 431 | ||
437 | if (IS_ERR(wl->rootdir)) { | 432 | if (IS_ERR(rootdir)) { |
438 | ret = PTR_ERR(wl->rootdir); | 433 | ret = PTR_ERR(rootdir); |
439 | wl->rootdir = NULL; | ||
440 | goto err; | 434 | goto err; |
441 | } | 435 | } |
442 | 436 | ||
@@ -450,7 +444,7 @@ int wl1271_debugfs_init(struct wl1271 *wl) | |||
450 | 444 | ||
451 | wl->stats.fw_stats_update = jiffies; | 445 | wl->stats.fw_stats_update = jiffies; |
452 | 446 | ||
453 | ret = wl1271_debugfs_add_files(wl); | 447 | ret = wl1271_debugfs_add_files(wl, rootdir); |
454 | 448 | ||
455 | if (ret < 0) | 449 | if (ret < 0) |
456 | goto err_file; | 450 | goto err_file; |
@@ -462,8 +456,7 @@ err_file: | |||
462 | wl->stats.fw_stats = NULL; | 456 | wl->stats.fw_stats = NULL; |
463 | 457 | ||
464 | err_fw: | 458 | err_fw: |
465 | debugfs_remove_recursive(wl->rootdir); | 459 | debugfs_remove_recursive(rootdir); |
466 | wl->rootdir = NULL; | ||
467 | 460 | ||
468 | err: | 461 | err: |
469 | return ret; | 462 | return ret; |
@@ -473,8 +466,4 @@ void wl1271_debugfs_exit(struct wl1271 *wl) | |||
473 | { | 466 | { |
474 | kfree(wl->stats.fw_stats); | 467 | kfree(wl->stats.fw_stats); |
475 | wl->stats.fw_stats = NULL; | 468 | wl->stats.fw_stats = NULL; |
476 | |||
477 | debugfs_remove_recursive(wl->rootdir); | ||
478 | wl->rootdir = NULL; | ||
479 | |||
480 | } | 469 | } |