diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-09-21 05:30:05 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-09-27 17:13:38 -0400 |
commit | 29d8a5909bba10accb82eb805c884a2943d7710f (patch) | |
tree | ace4d84b217f017fe8190c7ad9a0bfe356fd5742 /net | |
parent | ee22be7ef4f1d010a76fb41dc8fc687d38e606a3 (diff) |
Bluetooth: Factor out Create Configuration Response
Use function to factor out similar code. For BR/EDR send EFS
Configuration Response immediately, for HS response will be sent
after receiving HCI Logical Link Complete event in the following
patches.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index c9ba707d7b79..b4e707bfc08d 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -3582,6 +3582,22 @@ static inline void set_default_fcs(struct l2cap_chan *chan) | |||
3582 | chan->fcs = L2CAP_FCS_CRC16; | 3582 | chan->fcs = L2CAP_FCS_CRC16; |
3583 | } | 3583 | } |
3584 | 3584 | ||
3585 | static void l2cap_send_efs_conf_rsp(struct l2cap_chan *chan, void *data, | ||
3586 | u8 ident, u16 flags) | ||
3587 | { | ||
3588 | struct l2cap_conn *conn = chan->conn; | ||
3589 | |||
3590 | BT_DBG("conn %p chan %p ident %d flags 0x%4.4x", conn, chan, ident, | ||
3591 | flags); | ||
3592 | |||
3593 | clear_bit(CONF_LOC_CONF_PEND, &chan->conf_state); | ||
3594 | set_bit(CONF_OUTPUT_DONE, &chan->conf_state); | ||
3595 | |||
3596 | l2cap_send_cmd(conn, ident, L2CAP_CONF_RSP, | ||
3597 | l2cap_build_conf_rsp(chan, data, | ||
3598 | L2CAP_CONF_SUCCESS, flags), data); | ||
3599 | } | ||
3600 | |||
3585 | static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data) | 3601 | static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data) |
3586 | { | 3602 | { |
3587 | struct l2cap_conf_req *req = (struct l2cap_conf_req *) data; | 3603 | struct l2cap_conf_req *req = (struct l2cap_conf_req *) data; |
@@ -3673,16 +3689,11 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
3673 | /* Got Conf Rsp PENDING from remote side and asume we sent | 3689 | /* Got Conf Rsp PENDING from remote side and asume we sent |
3674 | Conf Rsp PENDING in the code above */ | 3690 | Conf Rsp PENDING in the code above */ |
3675 | if (test_bit(CONF_REM_CONF_PEND, &chan->conf_state) && | 3691 | if (test_bit(CONF_REM_CONF_PEND, &chan->conf_state) && |
3676 | test_bit(CONF_LOC_CONF_PEND, &chan->conf_state)) { | 3692 | test_bit(CONF_LOC_CONF_PEND, &chan->conf_state)) { |
3677 | 3693 | ||
3678 | /* check compatibility */ | 3694 | /* check compatibility */ |
3679 | 3695 | ||
3680 | clear_bit(CONF_LOC_CONF_PEND, &chan->conf_state); | 3696 | l2cap_send_efs_conf_rsp(chan, rsp, cmd->ident, flags); |
3681 | set_bit(CONF_OUTPUT_DONE, &chan->conf_state); | ||
3682 | |||
3683 | l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, | ||
3684 | l2cap_build_conf_rsp(chan, rsp, | ||
3685 | L2CAP_CONF_SUCCESS, flags), rsp); | ||
3686 | } | 3697 | } |
3687 | 3698 | ||
3688 | unlock: | 3699 | unlock: |
@@ -3730,12 +3741,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
3730 | 3741 | ||
3731 | /* check compatibility */ | 3742 | /* check compatibility */ |
3732 | 3743 | ||
3733 | clear_bit(CONF_LOC_CONF_PEND, &chan->conf_state); | 3744 | l2cap_send_efs_conf_rsp(chan, buf, cmd->ident, 0); |
3734 | set_bit(CONF_OUTPUT_DONE, &chan->conf_state); | ||
3735 | |||
3736 | l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, | ||
3737 | l2cap_build_conf_rsp(chan, buf, | ||
3738 | L2CAP_CONF_SUCCESS, 0x0000), buf); | ||
3739 | } | 3745 | } |
3740 | goto done; | 3746 | goto done; |
3741 | 3747 | ||