提交 4cd2d983 编写于 作者: V Vinicius Costa Gomes 提交者: Gustavo Padovan

Bluetooth: Simplify a the connection type handling

Now that we have separate ways of doing connections for each link type,
we can do better than an "if" statement to handle each link type.
Signed-off-by: NVinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
上级 b7d839bf
...@@ -568,13 +568,16 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, ...@@ -568,13 +568,16 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
{ {
BT_DBG("%s dst %s", hdev->name, batostr(dst)); BT_DBG("%s dst %s", hdev->name, batostr(dst));
if (type == LE_LINK) switch (type) {
case LE_LINK:
return hci_connect_le(hdev, dst, dst_type, sec_level, auth_type); return hci_connect_le(hdev, dst, dst_type, sec_level, auth_type);
case ACL_LINK:
if (type == ACL_LINK)
return hci_connect_acl(hdev, dst, sec_level, auth_type); return hci_connect_acl(hdev, dst, sec_level, auth_type);
case SCO_LINK:
return hci_connect_sco(hdev, dst, sec_level, auth_type);
}
return hci_connect_sco(hdev, dst, sec_level, auth_type); return ERR_PTR(-EINVAL);
} }
/* Check link security requirement */ /* Check link security requirement */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册