Skip to content

Commit

Permalink
Bluetooth: Simplify a the connection type handling
Browse files Browse the repository at this point in the history
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: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
  • Loading branch information
Vinicius Costa Gomes authored and Gustavo Padovan committed Aug 15, 2012
1 parent b7d839b commit 4cd2d98
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions net/bluetooth/hci_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

if (type == LE_LINK)
switch (type) {
case LE_LINK:
return hci_connect_le(hdev, dst, dst_type, sec_level, auth_type);

if (type == ACL_LINK)
case ACL_LINK:
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 */
Expand Down

0 comments on commit 4cd2d98

Please sign in to comment.