[brcm63xx] add bcm63xx_spi based on reading shared/opensource/flash/spiflash.c from...
[openwrt.git] / package / mac80211 / patches / 404-ath9k-create-a-common-debugfs_root-for-all-device-i.patch
1 From 8f94fb99b3f88aeff95743633afcc88147b7a475 Mon Sep 17 00:00:00 2001
2 From: Gabor Juhos <juhosg@openwrt.org>
3 Date: Thu, 5 Mar 2009 15:07:10 +0100
4 Subject: [PATCH] ath9k: create a common debugfs_root for all device instances
5
6 The driver are trying to create an 'ath9k' directory in debugfs for each
7 device currently. If there are more than one device in the system, the
8 second try will always fail.
9
10 Changes-licensed-under: ISC
11
12 Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
13 Signed-off-by: Imre Kaloz <kaloz@openwrt.org>
14 ---
15 drivers/net/wireless/ath9k/debug.c | 24 ++++++++++++++++++------
16 drivers/net/wireless/ath9k/debug.h | 12 +++++++++++-
17 drivers/net/wireless/ath9k/main.c | 13 ++++++++++++-
18 3 files changed, 41 insertions(+), 8 deletions(-)
19
20 --- a/drivers/net/wireless/ath9k/debug.c
21 +++ b/drivers/net/wireless/ath9k/debug.c
22 @@ -19,6 +19,8 @@
23 static unsigned int ath9k_debug = DBG_DEFAULT;
24 module_param_named(debug, ath9k_debug, uint, 0);
25
26 +static struct dentry *ath9k_debugfs_root;
27 +
28 void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...)
29 {
30 if (!sc)
31 @@ -491,12 +493,8 @@ int ath9k_init_debug(struct ath_softc *s
32 {
33 sc->debug.debug_mask = ath9k_debug;
34
35 - sc->debug.debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
36 - if (!sc->debug.debugfs_root)
37 - goto err;
38 -
39 sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
40 - sc->debug.debugfs_root);
41 + ath9k_debugfs_root);
42 if (!sc->debug.debugfs_phy)
43 goto err;
44
45 @@ -538,5 +536,19 @@ void ath9k_exit_debug(struct ath_softc *
46 debugfs_remove(sc->debug.debugfs_interrupt);
47 debugfs_remove(sc->debug.debugfs_dma);
48 debugfs_remove(sc->debug.debugfs_phy);
49 - debugfs_remove(sc->debug.debugfs_root);
50 +}
51 +
52 +int ath9k_debug_create_root(void)
53 +{
54 + ath9k_debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
55 + if (!ath9k_debugfs_root)
56 + return -ENOENT;
57 +
58 + return 0;
59 +}
60 +
61 +void ath9k_debug_remove_root(void)
62 +{
63 + debugfs_remove(ath9k_debugfs_root);
64 + ath9k_debugfs_root = NULL;
65 }
66 --- a/drivers/net/wireless/ath9k/debug.h
67 +++ b/drivers/net/wireless/ath9k/debug.h
68 @@ -102,7 +102,6 @@ struct ath_stats {
69
70 struct ath9k_debug {
71 int debug_mask;
72 - struct dentry *debugfs_root;
73 struct dentry *debugfs_phy;
74 struct dentry *debugfs_dma;
75 struct dentry *debugfs_interrupt;
76 @@ -114,6 +113,8 @@ struct ath9k_debug {
77 void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...);
78 int ath9k_init_debug(struct ath_softc *sc);
79 void ath9k_exit_debug(struct ath_softc *sc);
80 +int ath9k_debug_create_root(void);
81 +void ath9k_debug_remove_root(void);
82 void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
83 void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb);
84 void ath_debug_stat_retries(struct ath_softc *sc, int rix,
85 @@ -135,6 +136,15 @@ static inline void ath9k_exit_debug(stru
86 {
87 }
88
89 +static inline int ath9k_debug_create_root(void)
90 +{
91 + return 0;
92 +}
93 +
94 +static inline void ath9k_debug_remove_root(void)
95 +{
96 +}
97 +
98 static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
99 enum ath9k_int status)
100 {
101 --- a/drivers/net/wireless/ath9k/main.c
102 +++ b/drivers/net/wireless/ath9k/main.c
103 @@ -2864,12 +2864,20 @@ static int __init ath9k_init(void)
104 goto err_out;
105 }
106
107 + error = ath9k_debug_create_root();
108 + if (error) {
109 + printk(KERN_ERR
110 + "ath9k: Unable to create debugfs root: %d\n",
111 + error);
112 + goto err_rate_unregister;
113 + }
114 +
115 error = ath_pci_init();
116 if (error < 0) {
117 printk(KERN_ERR
118 "ath9k: No PCI devices found, driver not installed.\n");
119 error = -ENODEV;
120 - goto err_rate_unregister;
121 + goto err_remove_root;
122 }
123
124 error = ath_ahb_init();
125 @@ -2883,6 +2891,8 @@ static int __init ath9k_init(void)
126 err_pci_exit:
127 ath_pci_exit();
128
129 + err_remove_root:
130 + ath9k_debug_remove_root();
131 err_rate_unregister:
132 ath_rate_control_unregister();
133 err_out:
134 @@ -2894,6 +2904,7 @@ static void __exit ath9k_exit(void)
135 {
136 ath_ahb_exit();
137 ath_pci_exit();
138 + ath9k_debug_remove_root();
139 ath_rate_control_unregister();
140 printk(KERN_INFO "%s: Driver unloaded\n", dev_info);
141 }
This page took 0.050624 seconds and 5 git commands to generate.