Skip to content

Commit

Permalink
Bluetooth: Refactor deferred setup test in rfcomm_dlc_close()
Browse files Browse the repository at this point in the history
Prepare for directly closing dlc if the RFCOMM session has not
yet been started; refactor the deferred setup test for only those
dlc states to which the test applies. Retains functional
equivalence.

Signed-off-by: Peter Hurley <[email protected]>
Tested-By: Alexander Holler <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
peterhurley authored and holtmann committed Feb 14, 2014
1 parent 4339c25 commit 5998e04
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions net/bluetooth/rfcomm/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,18 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
switch (d->state) {
case BT_CONNECT:
case BT_CONFIG:
case BT_OPEN:
case BT_CONNECT2:
if (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) {
set_bit(RFCOMM_AUTH_REJECT, &d->flags);
rfcomm_schedule();
break;
return 0;
}
}

switch (d->state) {
case BT_CONNECT:
case BT_CONFIG:
/* Fall through */

case BT_CONNECTED:
Expand All @@ -461,15 +468,6 @@ static int __rfcomm_dlc_close(struct rfcomm_dlc *d, int err)
}
break;

case BT_OPEN:
case BT_CONNECT2:
if (test_and_clear_bit(RFCOMM_DEFER_SETUP, &d->flags)) {
set_bit(RFCOMM_AUTH_REJECT, &d->flags);
rfcomm_schedule();
break;
}
/* Fall through */

default:
rfcomm_dlc_clear_timer(d);

Expand Down

0 comments on commit 5998e04

Please sign in to comment.