diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 3ed93938370a..7114bdff5958 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -4517,15 +4517,31 @@ void l2cap_move_start(struct l2cap_chan *chan) | |||
4517 | static void l2cap_do_create(struct l2cap_chan *chan, int result, | 4517 | static void l2cap_do_create(struct l2cap_chan *chan, int result, |
4518 | u8 local_amp_id, u8 remote_amp_id) | 4518 | u8 local_amp_id, u8 remote_amp_id) |
4519 | { | 4519 | { |
4520 | BT_DBG("chan %p state %s %u -> %u", chan, state_to_string(chan->state), | ||
4521 | local_amp_id, remote_amp_id); | ||
4522 | |||
4520 | chan->fcs = L2CAP_FCS_NONE; | 4523 | chan->fcs = L2CAP_FCS_NONE; |
4521 | 4524 | ||
4522 | if (!test_bit(CONF_CONNECT_PEND, &chan->conf_state)) { | 4525 | /* Outgoing channel on AMP */ |
4526 | if (chan->state == BT_CONNECT) { | ||
4527 | if (result == L2CAP_CR_SUCCESS) { | ||
4528 | chan->local_amp_id = local_amp_id; | ||
4529 | l2cap_send_create_chan_req(chan, remote_amp_id); | ||
4530 | } else { | ||
4531 | /* Revert to BR/EDR connect */ | ||
4532 | l2cap_send_conn_req(chan); | ||
4533 | } | ||
4534 | |||
4535 | return; | ||
4536 | } | ||
4537 | |||
4538 | /* Incoming channel on AMP */ | ||
4539 | if (__l2cap_no_conn_pending(chan)) { | ||
4523 | struct l2cap_conn_rsp rsp; | 4540 | struct l2cap_conn_rsp rsp; |
4524 | char buf[128]; | 4541 | char buf[128]; |
4525 | rsp.scid = cpu_to_le16(chan->dcid); | 4542 | rsp.scid = cpu_to_le16(chan->dcid); |
4526 | rsp.dcid = cpu_to_le16(chan->scid); | 4543 | rsp.dcid = cpu_to_le16(chan->scid); |
4527 | 4544 | ||
4528 | /* Incoming channel on AMP */ | ||
4529 | if (result == L2CAP_CR_SUCCESS) { | 4545 | if (result == L2CAP_CR_SUCCESS) { |
4530 | /* Send successful response */ | 4546 | /* Send successful response */ |
4531 | rsp.result = __constant_cpu_to_le16(L2CAP_CR_SUCCESS); | 4547 | rsp.result = __constant_cpu_to_le16(L2CAP_CR_SUCCESS); |
@@ -4547,15 +4563,6 @@ static void l2cap_do_create(struct l2cap_chan *chan, int result, | |||
4547 | l2cap_build_conf_req(chan, buf), buf); | 4563 | l2cap_build_conf_req(chan, buf), buf); |
4548 | chan->num_conf_req++; | 4564 | chan->num_conf_req++; |
4549 | } | 4565 | } |
4550 | } else { | ||
4551 | /* Outgoing channel on AMP */ | ||
4552 | if (result == L2CAP_CR_SUCCESS) { | ||
4553 | chan->local_amp_id = local_amp_id; | ||
4554 | l2cap_send_create_chan_req(chan, remote_amp_id); | ||
4555 | } else { | ||
4556 | /* Revert to BR/EDR connect */ | ||
4557 | l2cap_send_conn_req(chan); | ||
4558 | } | ||
4559 | } | 4566 | } |
4560 | } | 4567 | } |
4561 | 4568 | ||