summaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2012-07-27 19:32:59 -0300
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-08-15 00:53:19 -0300
commit4cd2d98340b4f03d5532c30fdaeb451b035429cb (patch)
treeec9c837bd2accce9368a865dcc1a04f7e03eb850 /net/bluetooth
parentb7d839bfff78a01705f3d7b0acd5257dc7b067c9 (diff)
downloadblackbird-op-linux-4cd2d98340b4f03d5532c30fdaeb451b035429cb.tar.gz
blackbird-op-linux-4cd2d98340b4f03d5532c30fdaeb451b035429cb.zip
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: Vinicius Costa Gomes <vinicius.gomes@openbossa.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_conn.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index de7df88a396b..2e7b7765e0ea 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -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 */
OpenPOWER on IntegriCloud