diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2014-02-09 20:59:12 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-02-14 13:39:30 -0800 |
commit | 5998e04063563ff2ffc779510f072ff0ff94163b (patch) | |
tree | 481e5d8461d78a3c779feabcad087d3171eface1 /net/bluetooth/rfcomm | |
parent | 4339c25afb0d49878fba5a989618ffe807aa46cd (diff) |
Bluetooth: Refactor deferred setup test in rfcomm_dlc_close()
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 <peter@hurleysoftware.com>
Tested-By: Alexander Holler <holler@ahsoftware.de>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/rfcomm')
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index e8898624cbaf..3ce5ae493d1d 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c @@ -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: @@ -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); |