aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb/uwb-debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/uwb/uwb-debug.c')
-rw-r--r--drivers/uwb/uwb-debug.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/drivers/uwb/uwb-debug.c b/drivers/uwb/uwb-debug.c
index 217ebaac128d..0e58071a232d 100644
--- a/drivers/uwb/uwb-debug.c
+++ b/drivers/uwb/uwb-debug.c
@@ -192,7 +192,7 @@ static ssize_t command_write(struct file *file, const char __user *buf,
192{ 192{
193 struct uwb_rc *rc = file->private_data; 193 struct uwb_rc *rc = file->private_data;
194 struct uwb_dbg_cmd cmd; 194 struct uwb_dbg_cmd cmd;
195 int ret; 195 int ret = 0;
196 196
197 if (len != sizeof(struct uwb_dbg_cmd)) 197 if (len != sizeof(struct uwb_dbg_cmd))
198 return -EINVAL; 198 return -EINVAL;
@@ -213,6 +213,12 @@ static ssize_t command_write(struct file *file, const char __user *buf,
213 case UWB_DBG_CMD_IE_RM: 213 case UWB_DBG_CMD_IE_RM:
214 ret = cmd_ie_rm(rc, &cmd.ie_rm); 214 ret = cmd_ie_rm(rc, &cmd.ie_rm);
215 break; 215 break;
216 case UWB_DBG_CMD_RADIO_START:
217 ret = uwb_radio_start(&rc->dbg->pal);
218 break;
219 case UWB_DBG_CMD_RADIO_STOP:
220 uwb_radio_stop(&rc->dbg->pal);
221 break;
216 default: 222 default:
217 return -EINVAL; 223 return -EINVAL;
218 } 224 }
@@ -306,6 +312,17 @@ static struct file_operations drp_avail_fops = {
306 .owner = THIS_MODULE, 312 .owner = THIS_MODULE,
307}; 313};
308 314
315static void uwb_dbg_channel_changed(struct uwb_pal *pal, int channel)
316{
317 struct uwb_dbg *dbg = container_of(pal, struct uwb_dbg, pal);
318 struct device *dev = &pal->rc->uwb_dev.dev;
319
320 if (channel > 0)
321 dev_info(dev, "debug: channel %d started\n", channel);
322 else
323 dev_info(dev, "debug: channel stopped\n");
324}
325
309static void uwb_dbg_new_rsv(struct uwb_pal *pal, struct uwb_rsv *rsv) 326static void uwb_dbg_new_rsv(struct uwb_pal *pal, struct uwb_rsv *rsv)
310{ 327{
311 struct uwb_dbg *dbg = container_of(pal, struct uwb_dbg, pal); 328 struct uwb_dbg *dbg = container_of(pal, struct uwb_dbg, pal);
@@ -329,8 +346,11 @@ void uwb_dbg_add_rc(struct uwb_rc *rc)
329 INIT_LIST_HEAD(&rc->dbg->rsvs); 346 INIT_LIST_HEAD(&rc->dbg->rsvs);
330 347
331 uwb_pal_init(&rc->dbg->pal); 348 uwb_pal_init(&rc->dbg->pal);
349 rc->dbg->pal.rc = rc;
350 rc->dbg->pal.channel_changed = uwb_dbg_channel_changed;
332 rc->dbg->pal.new_rsv = uwb_dbg_new_rsv; 351 rc->dbg->pal.new_rsv = uwb_dbg_new_rsv;
333 uwb_pal_register(rc, &rc->dbg->pal); 352 uwb_pal_register(&rc->dbg->pal);
353
334 if (root_dir) { 354 if (root_dir) {
335 rc->dbg->root_d = debugfs_create_dir(dev_name(&rc->uwb_dev.dev), 355 rc->dbg->root_d = debugfs_create_dir(dev_name(&rc->uwb_dev.dev),
336 root_dir); 356 root_dir);
@@ -364,7 +384,7 @@ void uwb_dbg_del_rc(struct uwb_rc *rc)
364 uwb_rsv_terminate(rsv); 384 uwb_rsv_terminate(rsv);
365 } 385 }
366 386
367 uwb_pal_unregister(rc, &rc->dbg->pal); 387 uwb_pal_unregister(&rc->dbg->pal);
368 388
369 if (root_dir) { 389 if (root_dir) {
370 debugfs_remove(rc->dbg->drp_avail_f); 390 debugfs_remove(rc->dbg->drp_avail_f);