aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb/pal.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/uwb/pal.c')
-rw-r--r--drivers/uwb/pal.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/uwb/pal.c b/drivers/uwb/pal.c
index 1afb38eacb9a..605765124f5b 100644
--- a/drivers/uwb/pal.c
+++ b/drivers/uwb/pal.c
@@ -32,13 +32,13 @@ EXPORT_SYMBOL_GPL(uwb_pal_init);
32 32
33/** 33/**
34 * uwb_pal_register - register a UWB PAL 34 * uwb_pal_register - register a UWB PAL
35 * @rc: the radio controller the PAL will be using
36 * @pal: the PAL 35 * @pal: the PAL
37 * 36 *
38 * The PAL must be initialized with uwb_pal_init(). 37 * The PAL must be initialized with uwb_pal_init().
39 */ 38 */
40int uwb_pal_register(struct uwb_rc *rc, struct uwb_pal *pal) 39int uwb_pal_register(struct uwb_pal *pal)
41{ 40{
41 struct uwb_rc *rc = pal->rc;
42 int ret; 42 int ret;
43 43
44 if (pal->device) { 44 if (pal->device) {
@@ -54,9 +54,9 @@ int uwb_pal_register(struct uwb_rc *rc, struct uwb_pal *pal)
54 } 54 }
55 } 55 }
56 56
57 spin_lock(&rc->pal_lock); 57 mutex_lock(&rc->uwb_dev.mutex);
58 list_add(&pal->node, &rc->pals); 58 list_add(&pal->node, &rc->pals);
59 spin_unlock(&rc->pal_lock); 59 mutex_unlock(&rc->uwb_dev.mutex);
60 60
61 return 0; 61 return 0;
62} 62}
@@ -64,14 +64,17 @@ EXPORT_SYMBOL_GPL(uwb_pal_register);
64 64
65/** 65/**
66 * uwb_pal_register - unregister a UWB PAL 66 * uwb_pal_register - unregister a UWB PAL
67 * @rc: the radio controller the PAL was using
68 * @pal: the PAL 67 * @pal: the PAL
69 */ 68 */
70void uwb_pal_unregister(struct uwb_rc *rc, struct uwb_pal *pal) 69void uwb_pal_unregister(struct uwb_pal *pal)
71{ 70{
72 spin_lock(&rc->pal_lock); 71 struct uwb_rc *rc = pal->rc;
72
73 uwb_radio_stop(pal);
74
75 mutex_lock(&rc->uwb_dev.mutex);
73 list_del(&pal->node); 76 list_del(&pal->node);
74 spin_unlock(&rc->pal_lock); 77 mutex_unlock(&rc->uwb_dev.mutex);
75 78
76 if (pal->device) { 79 if (pal->device) {
77 sysfs_remove_link(&rc->uwb_dev.dev.kobj, pal->name); 80 sysfs_remove_link(&rc->uwb_dev.dev.kobj, pal->name);
@@ -86,6 +89,5 @@ EXPORT_SYMBOL_GPL(uwb_pal_unregister);
86 */ 89 */
87void uwb_rc_pal_init(struct uwb_rc *rc) 90void uwb_rc_pal_init(struct uwb_rc *rc)
88{ 91{
89 spin_lock_init(&rc->pal_lock);
90 INIT_LIST_HEAD(&rc->pals); 92 INIT_LIST_HEAD(&rc->pals);
91} 93}