aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/uwb/uwb-debug.c
diff options
context:
space:
mode:
authorDavid Vrabel <david.vrabel@csr.com>2008-10-27 11:22:46 -0400
committerDavid Vrabel <david.vrabel@csr.com>2008-10-28 08:07:23 -0400
commitcae1c11414912bf77a62aebd65ced321f0b9da51 (patch)
tree1f83b9b82aec7f86740f8b1f7f5e8be1c6cf3196 /drivers/uwb/uwb-debug.c
parentb09ac64b7b2d93efab3998033588f5cb0e470ccf (diff)
uwb: reference count reservations
Reference counting the struct uwb_rsv's is safer and easier to get right than the transferring ownership of the structures from the PAL to reservation manager. This fixes an oops in the debug PAL after a reservation timed out. Signed-off-by: David Vrabel <david.vrabel@csr.com>
Diffstat (limited to 'drivers/uwb/uwb-debug.c')
-rw-r--r--drivers/uwb/uwb-debug.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/uwb/uwb-debug.c b/drivers/uwb/uwb-debug.c
index 6d232c35d07d..6db641e45313 100644
--- a/drivers/uwb/uwb-debug.c
+++ b/drivers/uwb/uwb-debug.c
@@ -104,6 +104,11 @@ static void uwb_dbg_rsv_cb(struct uwb_rsv *rsv)
104 104
105 dev_dbg(dev, "debug: rsv %s -> %s: %s\n", 105 dev_dbg(dev, "debug: rsv %s -> %s: %s\n",
106 owner, target, uwb_rsv_state_str(rsv->state)); 106 owner, target, uwb_rsv_state_str(rsv->state));
107
108 if (rsv->state == UWB_RSV_STATE_NONE) {
109 list_del(&rsv->pal_node);
110 uwb_rsv_destroy(rsv);
111 }
107} 112}
108 113
109static int cmd_rsv_establish(struct uwb_rc *rc, 114static int cmd_rsv_establish(struct uwb_rc *rc,
@@ -153,11 +158,11 @@ static int cmd_rsv_terminate(struct uwb_rc *rc,
153 found = rsv; 158 found = rsv;
154 break; 159 break;
155 } 160 }
161 i++;
156 } 162 }
157 if (!found) 163 if (!found)
158 return -EINVAL; 164 return -EINVAL;
159 165
160 list_del(&found->pal_node);
161 uwb_rsv_terminate(found); 166 uwb_rsv_terminate(found);
162 167
163 return 0; 168 return 0;
@@ -287,8 +292,10 @@ static void uwb_dbg_new_rsv(struct uwb_rsv *rsv)
287{ 292{
288 struct uwb_rc *rc = rsv->rc; 293 struct uwb_rc *rc = rsv->rc;
289 294
290 if (rc->dbg->accept) 295 if (rc->dbg->accept) {
296 list_add_tail(&rsv->pal_node, &rc->dbg->rsvs);
291 uwb_rsv_accept(rsv, uwb_dbg_rsv_cb, NULL); 297 uwb_rsv_accept(rsv, uwb_dbg_rsv_cb, NULL);
298 }
292} 299}
293 300
294/** 301/**
@@ -336,7 +343,7 @@ void uwb_dbg_del_rc(struct uwb_rc *rc)
336 return; 343 return;
337 344
338 list_for_each_entry_safe(rsv, t, &rc->dbg->rsvs, pal_node) { 345 list_for_each_entry_safe(rsv, t, &rc->dbg->rsvs, pal_node) {
339 uwb_rsv_destroy(rsv); 346 uwb_rsv_terminate(rsv);
340 } 347 }
341 348
342 uwb_pal_unregister(rc, &rc->dbg->pal); 349 uwb_pal_unregister(rc, &rc->dbg->pal);