diff options
author | Mat Martineau <mathewm@codeaurora.org> | 2012-10-11 10:48:22 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2012-10-12 05:12:19 -0400 |
commit | 4c89b6aad5b7c5c56dadca66af6ceae0addbf2bf (patch) | |
tree | 16644b9c0512a8358e825741434d7225c3f5c3a7 /net/bluetooth | |
parent | f5a2598d80fda49756f234a43bc332a13ce95128 (diff) |
Bluetooth: Factor out common L2CAP connection code
L2CAP connect requests and create channel requests share a significant
amount of code. This change moves common code to a new function.
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 54f5a4e98d33..867eda23435b 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -3394,7 +3394,8 @@ static inline int l2cap_command_rej(struct l2cap_conn *conn, struct l2cap_cmd_hd | |||
3394 | return 0; | 3394 | return 0; |
3395 | } | 3395 | } |
3396 | 3396 | ||
3397 | static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data) | 3397 | static void __l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, |
3398 | u8 *data, u8 rsp_code, u8 amp_id) | ||
3398 | { | 3399 | { |
3399 | struct l2cap_conn_req *req = (struct l2cap_conn_req *) data; | 3400 | struct l2cap_conn_req *req = (struct l2cap_conn_req *) data; |
3400 | struct l2cap_conn_rsp rsp; | 3401 | struct l2cap_conn_rsp rsp; |
@@ -3488,7 +3489,7 @@ sendresp: | |||
3488 | rsp.dcid = cpu_to_le16(dcid); | 3489 | rsp.dcid = cpu_to_le16(dcid); |
3489 | rsp.result = cpu_to_le16(result); | 3490 | rsp.result = cpu_to_le16(result); |
3490 | rsp.status = cpu_to_le16(status); | 3491 | rsp.status = cpu_to_le16(status); |
3491 | l2cap_send_cmd(conn, cmd->ident, L2CAP_CONN_RSP, sizeof(rsp), &rsp); | 3492 | l2cap_send_cmd(conn, cmd->ident, rsp_code, sizeof(rsp), &rsp); |
3492 | 3493 | ||
3493 | if (result == L2CAP_CR_PEND && status == L2CAP_CS_NO_INFO) { | 3494 | if (result == L2CAP_CR_PEND && status == L2CAP_CS_NO_INFO) { |
3494 | struct l2cap_info_req info; | 3495 | struct l2cap_info_req info; |
@@ -3511,7 +3512,12 @@ sendresp: | |||
3511 | l2cap_build_conf_req(chan, buf), buf); | 3512 | l2cap_build_conf_req(chan, buf), buf); |
3512 | chan->num_conf_req++; | 3513 | chan->num_conf_req++; |
3513 | } | 3514 | } |
3515 | } | ||
3514 | 3516 | ||
3517 | static int l2cap_connect_req(struct l2cap_conn *conn, | ||
3518 | struct l2cap_cmd_hdr *cmd, u8 *data) | ||
3519 | { | ||
3520 | __l2cap_connect(conn, cmd, data, L2CAP_CONN_RSP, 0); | ||
3515 | return 0; | 3521 | return 0; |
3516 | } | 3522 | } |
3517 | 3523 | ||