| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * AT86RF230/RF231 driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2009-2012 Siemens AG |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License version 2 |
|---|
| 8 | | - * as published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | 6 | * |
|---|
| 15 | 7 | * Written by: |
|---|
| 16 | 8 | * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com> |
|---|
| .. | .. |
|---|
| 1641 | 1633 | seq_printf(file, "INVALID:\t\t%8llu\n", lp->trac.invalid); |
|---|
| 1642 | 1634 | return 0; |
|---|
| 1643 | 1635 | } |
|---|
| 1636 | +DEFINE_SHOW_ATTRIBUTE(at86rf230_stats); |
|---|
| 1644 | 1637 | |
|---|
| 1645 | | -static int at86rf230_stats_open(struct inode *inode, struct file *file) |
|---|
| 1646 | | -{ |
|---|
| 1647 | | - return single_open(file, at86rf230_stats_show, inode->i_private); |
|---|
| 1648 | | -} |
|---|
| 1649 | | - |
|---|
| 1650 | | -static const struct file_operations at86rf230_stats_fops = { |
|---|
| 1651 | | - .open = at86rf230_stats_open, |
|---|
| 1652 | | - .read = seq_read, |
|---|
| 1653 | | - .llseek = seq_lseek, |
|---|
| 1654 | | - .release = single_release, |
|---|
| 1655 | | -}; |
|---|
| 1656 | | - |
|---|
| 1657 | | -static int at86rf230_debugfs_init(struct at86rf230_local *lp) |
|---|
| 1638 | +static void at86rf230_debugfs_init(struct at86rf230_local *lp) |
|---|
| 1658 | 1639 | { |
|---|
| 1659 | 1640 | char debugfs_dir_name[DNAME_INLINE_LEN + 1] = "at86rf230-"; |
|---|
| 1660 | | - struct dentry *stats; |
|---|
| 1661 | 1641 | |
|---|
| 1662 | 1642 | strncat(debugfs_dir_name, dev_name(&lp->spi->dev), DNAME_INLINE_LEN); |
|---|
| 1663 | 1643 | |
|---|
| 1664 | 1644 | at86rf230_debugfs_root = debugfs_create_dir(debugfs_dir_name, NULL); |
|---|
| 1665 | | - if (!at86rf230_debugfs_root) |
|---|
| 1666 | | - return -ENOMEM; |
|---|
| 1667 | 1645 | |
|---|
| 1668 | | - stats = debugfs_create_file("trac_stats", 0444, |
|---|
| 1669 | | - at86rf230_debugfs_root, lp, |
|---|
| 1670 | | - &at86rf230_stats_fops); |
|---|
| 1671 | | - if (!stats) |
|---|
| 1672 | | - return -ENOMEM; |
|---|
| 1673 | | - |
|---|
| 1674 | | - return 0; |
|---|
| 1646 | + debugfs_create_file("trac_stats", 0444, at86rf230_debugfs_root, lp, |
|---|
| 1647 | + &at86rf230_stats_fops); |
|---|
| 1675 | 1648 | } |
|---|
| 1676 | 1649 | |
|---|
| 1677 | 1650 | static void at86rf230_debugfs_remove(void) |
|---|
| .. | .. |
|---|
| 1679 | 1652 | debugfs_remove_recursive(at86rf230_debugfs_root); |
|---|
| 1680 | 1653 | } |
|---|
| 1681 | 1654 | #else |
|---|
| 1682 | | -static int at86rf230_debugfs_init(struct at86rf230_local *lp) { return 0; } |
|---|
| 1655 | +static void at86rf230_debugfs_init(struct at86rf230_local *lp) { } |
|---|
| 1683 | 1656 | static void at86rf230_debugfs_remove(void) { } |
|---|
| 1684 | 1657 | #endif |
|---|
| 1685 | 1658 | |
|---|
| .. | .. |
|---|
| 1779 | 1752 | /* going into sleep by default */ |
|---|
| 1780 | 1753 | at86rf230_sleep(lp); |
|---|
| 1781 | 1754 | |
|---|
| 1782 | | - rc = at86rf230_debugfs_init(lp); |
|---|
| 1783 | | - if (rc) |
|---|
| 1784 | | - goto free_dev; |
|---|
| 1755 | + at86rf230_debugfs_init(lp); |
|---|
| 1785 | 1756 | |
|---|
| 1786 | 1757 | rc = ieee802154_register_hw(lp->hw); |
|---|
| 1787 | 1758 | if (rc) |
|---|