aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb/lc-rc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/uwb/lc-rc.c')
-rw-r--r--drivers/uwb/lc-rc.c62
1 files changed, 20 insertions, 42 deletions
diff --git a/drivers/uwb/lc-rc.c b/drivers/uwb/lc-rc.c
index ee5772f00d42..9cf21e6bb624 100644
--- a/drivers/uwb/lc-rc.c
+++ b/drivers/uwb/lc-rc.c
@@ -36,8 +36,6 @@
36#include <linux/etherdevice.h> 36#include <linux/etherdevice.h>
37#include <linux/usb.h> 37#include <linux/usb.h>
38 38
39#define D_LOCAL 1
40#include <linux/uwb/debug.h>
41#include "uwb-internal.h" 39#include "uwb-internal.h"
42 40
43static int uwb_rc_index_match(struct device *dev, void *data) 41static int uwb_rc_index_match(struct device *dev, void *data)
@@ -81,9 +79,7 @@ static void uwb_rc_sys_release(struct device *dev)
81 struct uwb_dev *uwb_dev = container_of(dev, struct uwb_dev, dev); 79 struct uwb_dev *uwb_dev = container_of(dev, struct uwb_dev, dev);
82 struct uwb_rc *rc = container_of(uwb_dev, struct uwb_rc, uwb_dev); 80 struct uwb_rc *rc = container_of(uwb_dev, struct uwb_rc, uwb_dev);
83 81
84 uwb_rc_neh_destroy(rc);
85 uwb_rc_ie_release(rc); 82 uwb_rc_ie_release(rc);
86 d_printf(1, dev, "freed uwb_rc %p\n", rc);
87 kfree(rc); 83 kfree(rc);
88} 84}
89 85
@@ -100,6 +96,8 @@ void uwb_rc_init(struct uwb_rc *rc)
100 rc->scan_type = UWB_SCAN_DISABLED; 96 rc->scan_type = UWB_SCAN_DISABLED;
101 INIT_LIST_HEAD(&rc->notifs_chain.list); 97 INIT_LIST_HEAD(&rc->notifs_chain.list);
102 mutex_init(&rc->notifs_chain.mutex); 98 mutex_init(&rc->notifs_chain.mutex);
99 INIT_LIST_HEAD(&rc->uwb_beca.list);
100 mutex_init(&rc->uwb_beca.mutex);
103 uwb_drp_avail_init(rc); 101 uwb_drp_avail_init(rc);
104 uwb_rc_ie_init(rc); 102 uwb_rc_ie_init(rc);
105 uwb_rsv_init(rc); 103 uwb_rsv_init(rc);
@@ -191,9 +189,9 @@ static int uwb_rc_setup(struct uwb_rc *rc)
191 int result; 189 int result;
192 struct device *dev = &rc->uwb_dev.dev; 190 struct device *dev = &rc->uwb_dev.dev;
193 191
194 result = uwb_rc_reset(rc); 192 result = uwb_radio_setup(rc);
195 if (result < 0) { 193 if (result < 0) {
196 dev_err(dev, "cannot reset UWB radio: %d\n", result); 194 dev_err(dev, "cannot setup UWB radio: %d\n", result);
197 goto error; 195 goto error;
198 } 196 }
199 result = uwb_rc_mac_addr_setup(rc); 197 result = uwb_rc_mac_addr_setup(rc);
@@ -250,6 +248,12 @@ int uwb_rc_add(struct uwb_rc *rc, struct device *parent_dev, void *priv)
250 248
251 rc->priv = priv; 249 rc->priv = priv;
252 250
251 init_waitqueue_head(&rc->uwbd.wq);
252 INIT_LIST_HEAD(&rc->uwbd.event_list);
253 spin_lock_init(&rc->uwbd.event_list_lock);
254
255 uwbd_start(rc);
256
253 result = rc->start(rc); 257 result = rc->start(rc);
254 if (result < 0) 258 if (result < 0)
255 goto error_rc_start; 259 goto error_rc_start;
@@ -284,7 +288,7 @@ error_sys_add:
284error_dev_add: 288error_dev_add:
285error_rc_setup: 289error_rc_setup:
286 rc->stop(rc); 290 rc->stop(rc);
287 uwbd_flush(rc); 291 uwbd_stop(rc);
288error_rc_start: 292error_rc_start:
289 return result; 293 return result;
290} 294}
@@ -306,25 +310,24 @@ void uwb_rc_rm(struct uwb_rc *rc)
306 rc->ready = 0; 310 rc->ready = 0;
307 311
308 uwb_dbg_del_rc(rc); 312 uwb_dbg_del_rc(rc);
309 uwb_rsv_cleanup(rc); 313 uwb_rsv_remove_all(rc);
310 uwb_rc_ie_rm(rc, UWB_IDENTIFICATION_IE); 314 uwb_radio_shutdown(rc);
311 if (rc->beaconing >= 0)
312 uwb_rc_beacon(rc, -1, 0);
313 if (rc->scan_type != UWB_SCAN_DISABLED)
314 uwb_rc_scan(rc, rc->scanning, UWB_SCAN_DISABLED, 0);
315 uwb_rc_reset(rc);
316 315
317 rc->stop(rc); 316 rc->stop(rc);
318 uwbd_flush(rc); 317
318 uwbd_stop(rc);
319 uwb_rc_neh_destroy(rc);
319 320
320 uwb_dev_lock(&rc->uwb_dev); 321 uwb_dev_lock(&rc->uwb_dev);
321 rc->priv = NULL; 322 rc->priv = NULL;
322 rc->cmd = NULL; 323 rc->cmd = NULL;
323 uwb_dev_unlock(&rc->uwb_dev); 324 uwb_dev_unlock(&rc->uwb_dev);
324 mutex_lock(&uwb_beca.mutex); 325 mutex_lock(&rc->uwb_beca.mutex);
325 uwb_dev_for_each(rc, uwb_dev_offair_helper, NULL); 326 uwb_dev_for_each(rc, uwb_dev_offair_helper, NULL);
326 __uwb_rc_sys_rm(rc); 327 __uwb_rc_sys_rm(rc);
327 mutex_unlock(&uwb_beca.mutex); 328 mutex_unlock(&rc->uwb_beca.mutex);
329 uwb_rsv_cleanup(rc);
330 uwb_beca_release(rc);
328 uwb_dev_rm(&rc->uwb_dev); 331 uwb_dev_rm(&rc->uwb_dev);
329} 332}
330EXPORT_SYMBOL_GPL(uwb_rc_rm); 333EXPORT_SYMBOL_GPL(uwb_rc_rm);
@@ -468,28 +471,3 @@ void uwb_rc_put(struct uwb_rc *rc)
468 __uwb_rc_put(rc); 471 __uwb_rc_put(rc);
469} 472}
470EXPORT_SYMBOL_GPL(uwb_rc_put); 473EXPORT_SYMBOL_GPL(uwb_rc_put);
471
472/*
473 *
474 *
475 */
476ssize_t uwb_rc_print_IEs(struct uwb_rc *uwb_rc, char *buf, size_t size)
477{
478 ssize_t result;
479 struct uwb_rc_evt_get_ie *ie_info;
480 struct uwb_buf_ctx ctx;
481
482 result = uwb_rc_get_ie(uwb_rc, &ie_info);
483 if (result < 0)
484 goto error_get_ie;
485 ctx.buf = buf;
486 ctx.size = size;
487 ctx.bytes = 0;
488 uwb_ie_for_each(&uwb_rc->uwb_dev, uwb_ie_dump_hex, &ctx,
489 ie_info->IEData, result - sizeof(*ie_info));
490 result = ctx.bytes;
491 kfree(ie_info);
492error_get_ie:
493 return result;
494}
495