blob: 4617bd12f63bb953afe7fcde257907606c6a54f7 [file] [log] [blame]
Bing Zhaofb784f02009-06-02 14:29:37 -07001/**
2 * Marvell Bluetooth driver: debugfs related functions
3 *
4 * Copyright (C) 2009, Marvell International Ltd.
5 *
6 * This software file (the "File") is distributed by Marvell International
7 * Ltd. under the terms of the GNU General Public License Version 2, June 1991
8 * (the "License"). You may use, redistribute and/or modify this File in
9 * accordance with the terms and conditions of the License, a copy of which
10 * is available by writing to the Free Software Foundation, Inc.,
11 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
12 * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
13 *
14 *
15 * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
17 * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
18 * this warranty disclaimer.
19 **/
20
21#include <linux/debugfs.h>
22
23#include <net/bluetooth/bluetooth.h>
24#include <net/bluetooth/hci_core.h>
25
26#include "btmrvl_drv.h"
27
28struct btmrvl_debugfs_data {
29 struct dentry *root_dir, *config_dir, *status_dir;
30
31 /* config */
32 struct dentry *drvdbg;
33 struct dentry *psmode;
34 struct dentry *pscmd;
35 struct dentry *hsmode;
36 struct dentry *hscmd;
37 struct dentry *gpiogap;
38 struct dentry *hscfgcmd;
39
40 /* status */
41 struct dentry *curpsmode;
42 struct dentry *hsstate;
43 struct dentry *psstate;
44 struct dentry *txdnldready;
45};
46
47static int btmrvl_open_generic(struct inode *inode, struct file *file)
48{
49 file->private_data = inode->i_private;
50 return 0;
51}
52
53static ssize_t btmrvl_hscfgcmd_write(struct file *file,
Marcel Holtmann54239902009-06-09 15:48:35 +020054 const char __user *ubuf, size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -070055{
Marcel Holtmann54239902009-06-09 15:48:35 +020056 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -070057 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +020058 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -070059
60 memset(buf, 0, sizeof(buf));
61
Marcel Holtmann54239902009-06-09 15:48:35 +020062 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -070063 return -EFAULT;
64
65 ret = strict_strtol(buf, 10, &result);
66
67 priv->btmrvl_dev.hscfgcmd = result;
68
69 if (priv->btmrvl_dev.hscfgcmd) {
70 btmrvl_prepare_command(priv);
71 wake_up_interruptible(&priv->main_thread.wait_q);
72 }
73
74 return count;
75}
76
Marcel Holtmann54239902009-06-09 15:48:35 +020077static ssize_t btmrvl_hscfgcmd_read(struct file *file, char __user *userbuf,
78 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -070079{
Marcel Holtmann54239902009-06-09 15:48:35 +020080 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -070081 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +020082 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -070083
84 ret = snprintf(buf, sizeof(buf) - 1, "%d\n",
Marcel Holtmann54239902009-06-09 15:48:35 +020085 priv->btmrvl_dev.hscfgcmd);
Bing Zhaofb784f02009-06-02 14:29:37 -070086
87 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
88}
89
90static const struct file_operations btmrvl_hscfgcmd_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +020091 .read = btmrvl_hscfgcmd_read,
92 .write = btmrvl_hscfgcmd_write,
93 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -070094};
95
96static ssize_t btmrvl_psmode_write(struct file *file, const char __user *ubuf,
Marcel Holtmann54239902009-06-09 15:48:35 +020097 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -070098{
Marcel Holtmann54239902009-06-09 15:48:35 +020099 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700100 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200101 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700102
103 memset(buf, 0, sizeof(buf));
104
Marcel Holtmann54239902009-06-09 15:48:35 +0200105 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -0700106 return -EFAULT;
107
108 ret = strict_strtol(buf, 10, &result);
109
110 priv->btmrvl_dev.psmode = result;
111
112 return count;
113}
114
Marcel Holtmann54239902009-06-09 15:48:35 +0200115static ssize_t btmrvl_psmode_read(struct file *file, char __user *userbuf,
116 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700117{
Marcel Holtmann54239902009-06-09 15:48:35 +0200118 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700119 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200120 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700121
122 ret = snprintf(buf, sizeof(buf) - 1, "%d\n",
Marcel Holtmann54239902009-06-09 15:48:35 +0200123 priv->btmrvl_dev.psmode);
Bing Zhaofb784f02009-06-02 14:29:37 -0700124
125 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
126}
127
128static const struct file_operations btmrvl_psmode_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200129 .read = btmrvl_psmode_read,
130 .write = btmrvl_psmode_write,
131 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700132};
133
134static ssize_t btmrvl_pscmd_write(struct file *file, const char __user *ubuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200135 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700136{
Marcel Holtmann54239902009-06-09 15:48:35 +0200137 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700138 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200139 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700140
141 memset(buf, 0, sizeof(buf));
142
Marcel Holtmann54239902009-06-09 15:48:35 +0200143 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -0700144 return -EFAULT;
145
146 ret = strict_strtol(buf, 10, &result);
147
148 priv->btmrvl_dev.pscmd = result;
149
150 if (priv->btmrvl_dev.pscmd) {
151 btmrvl_prepare_command(priv);
152 wake_up_interruptible(&priv->main_thread.wait_q);
153 }
154
155 return count;
156
157}
158
Marcel Holtmann54239902009-06-09 15:48:35 +0200159static ssize_t btmrvl_pscmd_read(struct file *file, char __user *userbuf,
160 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700161{
Marcel Holtmann54239902009-06-09 15:48:35 +0200162 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700163 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200164 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700165
166 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.pscmd);
167
168 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
169}
170
171static const struct file_operations btmrvl_pscmd_fops = {
172 .read = btmrvl_pscmd_read,
173 .write = btmrvl_pscmd_write,
174 .open = btmrvl_open_generic,
175};
176
177static ssize_t btmrvl_gpiogap_write(struct file *file, const char __user *ubuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200178 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700179{
Marcel Holtmann54239902009-06-09 15:48:35 +0200180 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700181 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200182 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700183
184 memset(buf, 0, sizeof(buf));
185
Marcel Holtmann54239902009-06-09 15:48:35 +0200186 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -0700187 return -EFAULT;
188
189 ret = strict_strtol(buf, 16, &result);
190
191 priv->btmrvl_dev.gpio_gap = result;
192
193 return count;
194}
195
Marcel Holtmann54239902009-06-09 15:48:35 +0200196static ssize_t btmrvl_gpiogap_read(struct file *file, char __user *userbuf,
197 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700198{
Marcel Holtmann54239902009-06-09 15:48:35 +0200199 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700200 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200201 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700202
203 ret = snprintf(buf, sizeof(buf) - 1, "0x%x\n",
Marcel Holtmann54239902009-06-09 15:48:35 +0200204 priv->btmrvl_dev.gpio_gap);
Bing Zhaofb784f02009-06-02 14:29:37 -0700205
206 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
207}
208
209static const struct file_operations btmrvl_gpiogap_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200210 .read = btmrvl_gpiogap_read,
211 .write = btmrvl_gpiogap_write,
212 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700213};
214
215static ssize_t btmrvl_hscmd_write(struct file *file, const char __user *ubuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200216 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700217{
Marcel Holtmann54239902009-06-09 15:48:35 +0200218 struct btmrvl_private *priv = (struct btmrvl_private *) file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700219 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200220 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700221
222 memset(buf, 0, sizeof(buf));
223
Marcel Holtmann54239902009-06-09 15:48:35 +0200224 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -0700225 return -EFAULT;
226
227 ret = strict_strtol(buf, 10, &result);
228
229 priv->btmrvl_dev.hscmd = result;
230 if (priv->btmrvl_dev.hscmd) {
231 btmrvl_prepare_command(priv);
232 wake_up_interruptible(&priv->main_thread.wait_q);
233 }
234
235 return count;
236}
237
Marcel Holtmann54239902009-06-09 15:48:35 +0200238static ssize_t btmrvl_hscmd_read(struct file *file, char __user *userbuf,
239 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700240{
Marcel Holtmann54239902009-06-09 15:48:35 +0200241 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700242 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200243 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700244
245 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.hscmd);
246
247 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
248}
249
250static const struct file_operations btmrvl_hscmd_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200251 .read = btmrvl_hscmd_read,
252 .write = btmrvl_hscmd_write,
253 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700254};
255
256static ssize_t btmrvl_hsmode_write(struct file *file, const char __user *ubuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200257 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700258{
Marcel Holtmann54239902009-06-09 15:48:35 +0200259 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700260 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200261 long result, ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700262
263 memset(buf, 0, sizeof(buf));
264
Marcel Holtmann54239902009-06-09 15:48:35 +0200265 if (copy_from_user(&buf, ubuf, min_t(size_t, sizeof(buf) - 1, count)))
Bing Zhaofb784f02009-06-02 14:29:37 -0700266 return -EFAULT;
267
268 ret = strict_strtol(buf, 10, &result);
269
270 priv->btmrvl_dev.hsmode = result;
271
272 return count;
273}
274
275static ssize_t btmrvl_hsmode_read(struct file *file, char __user * userbuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200276 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700277{
Marcel Holtmann54239902009-06-09 15:48:35 +0200278 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700279 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200280 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700281
Marcel Holtmann54239902009-06-09 15:48:35 +0200282 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->btmrvl_dev.hsmode);
Bing Zhaofb784f02009-06-02 14:29:37 -0700283
284 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
285}
286
287static const struct file_operations btmrvl_hsmode_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200288 .read = btmrvl_hsmode_read,
289 .write = btmrvl_hsmode_write,
290 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700291};
292
Marcel Holtmann54239902009-06-09 15:48:35 +0200293static ssize_t btmrvl_curpsmode_read(struct file *file, char __user *userbuf,
294 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700295{
Marcel Holtmann54239902009-06-09 15:48:35 +0200296 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700297 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200298 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700299
300 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->adapter->psmode);
301
302 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
303}
304
305static const struct file_operations btmrvl_curpsmode_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200306 .read = btmrvl_curpsmode_read,
307 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700308};
309
310static ssize_t btmrvl_psstate_read(struct file *file, char __user * userbuf,
Marcel Holtmann54239902009-06-09 15:48:35 +0200311 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700312{
Marcel Holtmann54239902009-06-09 15:48:35 +0200313 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700314 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200315 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700316
Marcel Holtmann54239902009-06-09 15:48:35 +0200317 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->adapter->ps_state);
Bing Zhaofb784f02009-06-02 14:29:37 -0700318
319 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
320}
321
322static const struct file_operations btmrvl_psstate_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200323 .read = btmrvl_psstate_read,
324 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700325};
326
Marcel Holtmann54239902009-06-09 15:48:35 +0200327static ssize_t btmrvl_hsstate_read(struct file *file, char __user *userbuf,
328 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700329{
Marcel Holtmann54239902009-06-09 15:48:35 +0200330 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700331 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200332 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700333
Marcel Holtmann54239902009-06-09 15:48:35 +0200334 ret = snprintf(buf, sizeof(buf) - 1, "%d\n", priv->adapter->hs_state);
Bing Zhaofb784f02009-06-02 14:29:37 -0700335
336 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
337}
338
339static const struct file_operations btmrvl_hsstate_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200340 .read = btmrvl_hsstate_read,
341 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700342};
343
Marcel Holtmann54239902009-06-09 15:48:35 +0200344static ssize_t btmrvl_txdnldready_read(struct file *file, char __user *userbuf,
345 size_t count, loff_t *ppos)
Bing Zhaofb784f02009-06-02 14:29:37 -0700346{
Marcel Holtmann54239902009-06-09 15:48:35 +0200347 struct btmrvl_private *priv = file->private_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700348 char buf[16];
Marcel Holtmann54239902009-06-09 15:48:35 +0200349 int ret;
Bing Zhaofb784f02009-06-02 14:29:37 -0700350
351 ret = snprintf(buf, sizeof(buf) - 1, "%d\n",
Marcel Holtmann54239902009-06-09 15:48:35 +0200352 priv->btmrvl_dev.tx_dnld_rdy);
Bing Zhaofb784f02009-06-02 14:29:37 -0700353
354 return simple_read_from_buffer(userbuf, count, ppos, buf, ret);
355}
356
357static const struct file_operations btmrvl_txdnldready_fops = {
Marcel Holtmann54239902009-06-09 15:48:35 +0200358 .read = btmrvl_txdnldready_read,
359 .open = btmrvl_open_generic,
Bing Zhaofb784f02009-06-02 14:29:37 -0700360};
361
362void btmrvl_debugfs_init(struct hci_dev *hdev)
363{
Marcel Holtmann54239902009-06-09 15:48:35 +0200364 struct btmrvl_private *priv = hdev->driver_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700365 struct btmrvl_debugfs_data *dbg;
366
367 dbg = kzalloc(sizeof(*dbg), GFP_KERNEL);
368 priv->debugfs_data = dbg;
369
370 if (!dbg) {
371 BT_ERR("Can not allocate memory for btmrvl_debugfs_data.");
372 return;
373 }
374
375 dbg->root_dir = debugfs_create_dir("btmrvl", NULL);
376
377 dbg->config_dir = debugfs_create_dir("config", dbg->root_dir);
378
379 dbg->psmode = debugfs_create_file("psmode", 0644, dbg->config_dir,
Marcel Holtmann54239902009-06-09 15:48:35 +0200380 hdev->driver_data, &btmrvl_psmode_fops);
381 dbg->pscmd = debugfs_create_file("pscmd", 0644, dbg->config_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700382 hdev->driver_data, &btmrvl_pscmd_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200383 dbg->gpiogap = debugfs_create_file("gpiogap", 0644, dbg->config_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700384 hdev->driver_data, &btmrvl_gpiogap_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200385 dbg->hsmode = debugfs_create_file("hsmode", 0644, dbg->config_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700386 hdev->driver_data, &btmrvl_hsmode_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200387 dbg->hscmd = debugfs_create_file("hscmd", 0644, dbg->config_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700388 hdev->driver_data, &btmrvl_hscmd_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200389 dbg->hscfgcmd = debugfs_create_file("hscfgcmd", 0644, dbg->config_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700390 hdev->driver_data, &btmrvl_hscfgcmd_fops);
391
392 dbg->status_dir = debugfs_create_dir("status", dbg->root_dir);
393 dbg->curpsmode = debugfs_create_file("curpsmode", 0444,
394 dbg->status_dir,
395 hdev->driver_data,
396 &btmrvl_curpsmode_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200397 dbg->psstate = debugfs_create_file("psstate", 0444, dbg->status_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700398 hdev->driver_data, &btmrvl_psstate_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200399 dbg->hsstate = debugfs_create_file("hsstate", 0444, dbg->status_dir,
Bing Zhaofb784f02009-06-02 14:29:37 -0700400 hdev->driver_data, &btmrvl_hsstate_fops);
Marcel Holtmann54239902009-06-09 15:48:35 +0200401 dbg->txdnldready = debugfs_create_file("txdnldready", 0444,
402 dbg->status_dir,
403 hdev->driver_data,
404 &btmrvl_txdnldready_fops);
Bing Zhaofb784f02009-06-02 14:29:37 -0700405}
406
407void btmrvl_debugfs_remove(struct hci_dev *hdev)
408{
Marcel Holtmann54239902009-06-09 15:48:35 +0200409 struct btmrvl_private *priv = hdev->driver_data;
Bing Zhaofb784f02009-06-02 14:29:37 -0700410 struct btmrvl_debugfs_data *dbg = priv->debugfs_data;
411
412 if (!dbg)
413 return;
414
415 debugfs_remove(dbg->psmode);
416 debugfs_remove(dbg->pscmd);
417 debugfs_remove(dbg->gpiogap);
418 debugfs_remove(dbg->hsmode);
419 debugfs_remove(dbg->hscmd);
420 debugfs_remove(dbg->hscfgcmd);
421 debugfs_remove(dbg->config_dir);
422
423 debugfs_remove(dbg->curpsmode);
424 debugfs_remove(dbg->psstate);
425 debugfs_remove(dbg->hsstate);
426 debugfs_remove(dbg->txdnldready);
427 debugfs_remove(dbg->status_dir);
428
429 debugfs_remove(dbg->root_dir);
430
431 kfree(dbg);
432}