| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * mac80211 glue code for mac80211 ST-Ericsson CW1200 drivers |
|---|
| 3 | 4 | * DebugFS code |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * Copyright (c) 2010, ST-Ericsson |
|---|
| 6 | 7 | * Author: Dmitry Tarnyagin <dmitry.tarnyagin@lockless.no> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 289 | 286 | return 0; |
|---|
| 290 | 287 | } |
|---|
| 291 | 288 | |
|---|
| 292 | | -static int cw1200_status_open(struct inode *inode, struct file *file) |
|---|
| 293 | | -{ |
|---|
| 294 | | - return single_open(file, &cw1200_status_show, |
|---|
| 295 | | - inode->i_private); |
|---|
| 296 | | -} |
|---|
| 297 | | - |
|---|
| 298 | | -static const struct file_operations fops_status = { |
|---|
| 299 | | - .open = cw1200_status_open, |
|---|
| 300 | | - .read = seq_read, |
|---|
| 301 | | - .llseek = seq_lseek, |
|---|
| 302 | | - .release = single_release, |
|---|
| 303 | | - .owner = THIS_MODULE, |
|---|
| 304 | | -}; |
|---|
| 289 | +DEFINE_SHOW_ATTRIBUTE(cw1200_status); |
|---|
| 305 | 290 | |
|---|
| 306 | 291 | static int cw1200_counters_show(struct seq_file *seq, void *v) |
|---|
| 307 | 292 | { |
|---|
| .. | .. |
|---|
| 345 | 330 | return 0; |
|---|
| 346 | 331 | } |
|---|
| 347 | 332 | |
|---|
| 348 | | -static int cw1200_counters_open(struct inode *inode, struct file *file) |
|---|
| 349 | | -{ |
|---|
| 350 | | - return single_open(file, &cw1200_counters_show, |
|---|
| 351 | | - inode->i_private); |
|---|
| 352 | | -} |
|---|
| 353 | | - |
|---|
| 354 | | -static const struct file_operations fops_counters = { |
|---|
| 355 | | - .open = cw1200_counters_open, |
|---|
| 356 | | - .read = seq_read, |
|---|
| 357 | | - .llseek = seq_lseek, |
|---|
| 358 | | - .release = single_release, |
|---|
| 359 | | - .owner = THIS_MODULE, |
|---|
| 360 | | -}; |
|---|
| 333 | +DEFINE_SHOW_ATTRIBUTE(cw1200_counters); |
|---|
| 361 | 334 | |
|---|
| 362 | 335 | static ssize_t cw1200_wsm_dumps(struct file *file, |
|---|
| 363 | 336 | const char __user *user_buf, size_t count, loff_t *ppos) |
|---|
| .. | .. |
|---|
| 395 | 368 | |
|---|
| 396 | 369 | d->debugfs_phy = debugfs_create_dir("cw1200", |
|---|
| 397 | 370 | priv->hw->wiphy->debugfsdir); |
|---|
| 398 | | - if (!d->debugfs_phy) |
|---|
| 399 | | - goto err; |
|---|
| 400 | | - |
|---|
| 401 | | - if (!debugfs_create_file("status", 0400, d->debugfs_phy, |
|---|
| 402 | | - priv, &fops_status)) |
|---|
| 403 | | - goto err; |
|---|
| 404 | | - |
|---|
| 405 | | - if (!debugfs_create_file("counters", 0400, d->debugfs_phy, |
|---|
| 406 | | - priv, &fops_counters)) |
|---|
| 407 | | - goto err; |
|---|
| 408 | | - |
|---|
| 409 | | - if (!debugfs_create_file("wsm_dumps", 0200, d->debugfs_phy, |
|---|
| 410 | | - priv, &fops_wsm_dumps)) |
|---|
| 411 | | - goto err; |
|---|
| 371 | + debugfs_create_file("status", 0400, d->debugfs_phy, priv, |
|---|
| 372 | + &cw1200_status_fops); |
|---|
| 373 | + debugfs_create_file("counters", 0400, d->debugfs_phy, priv, |
|---|
| 374 | + &cw1200_counters_fops); |
|---|
| 375 | + debugfs_create_file("wsm_dumps", 0200, d->debugfs_phy, priv, |
|---|
| 376 | + &fops_wsm_dumps); |
|---|
| 412 | 377 | |
|---|
| 413 | 378 | return 0; |
|---|
| 414 | | - |
|---|
| 415 | | -err: |
|---|
| 416 | | - priv->debug = NULL; |
|---|
| 417 | | - debugfs_remove_recursive(d->debugfs_phy); |
|---|
| 418 | | - kfree(d); |
|---|
| 419 | | - return ret; |
|---|
| 420 | 379 | } |
|---|
| 421 | 380 | |
|---|
| 422 | 381 | void cw1200_debug_release(struct cw1200_common *priv) |
|---|