hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/drivers/net/ieee802154/at86rf230.c
....@@ -1,16 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * AT86RF230/RF231 driver
34 *
45 * 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.
146 *
157 * Written by:
168 * Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
....@@ -1641,37 +1633,18 @@
16411633 seq_printf(file, "INVALID:\t\t%8llu\n", lp->trac.invalid);
16421634 return 0;
16431635 }
1636
+DEFINE_SHOW_ATTRIBUTE(at86rf230_stats);
16441637
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)
16581639 {
16591640 char debugfs_dir_name[DNAME_INLINE_LEN + 1] = "at86rf230-";
1660
- struct dentry *stats;
16611641
16621642 strncat(debugfs_dir_name, dev_name(&lp->spi->dev), DNAME_INLINE_LEN);
16631643
16641644 at86rf230_debugfs_root = debugfs_create_dir(debugfs_dir_name, NULL);
1665
- if (!at86rf230_debugfs_root)
1666
- return -ENOMEM;
16671645
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);
16751648 }
16761649
16771650 static void at86rf230_debugfs_remove(void)
....@@ -1679,7 +1652,7 @@
16791652 debugfs_remove_recursive(at86rf230_debugfs_root);
16801653 }
16811654 #else
1682
-static int at86rf230_debugfs_init(struct at86rf230_local *lp) { return 0; }
1655
+static void at86rf230_debugfs_init(struct at86rf230_local *lp) { }
16831656 static void at86rf230_debugfs_remove(void) { }
16841657 #endif
16851658
....@@ -1779,9 +1752,7 @@
17791752 /* going into sleep by default */
17801753 at86rf230_sleep(lp);
17811754
1782
- rc = at86rf230_debugfs_init(lp);
1783
- if (rc)
1784
- goto free_dev;
1755
+ at86rf230_debugfs_init(lp);
17851756
17861757 rc = ieee802154_register_hw(lp->hw);
17871758 if (rc)