Skip to content

Commit e660ed6

Browse files
Frédéric DalleauGustavo Padovan
authored andcommitted
Bluetooth: Use hci_connect_sco directly
hci_connect is a super function for connecting hci protocols. But the voice_setting parameter (introduced in subsequent patches) is only needed by SCO and security requirements are not needed for SCO channels. Thus, it makes sense to have a separate function for SCO. Signed-off-by: Frédéric Dalleau <[email protected]> Acked-by: Marcel Holtmann <[email protected]> Signed-off-by: Johan Hedberg <[email protected]> Signed-off-by: Gustavo Padovan <[email protected]>
1 parent ffe6b68 commit e660ed6

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

include/net/bluetooth/hci_core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,8 @@ struct hci_chan *hci_chan_lookup_handle(struct hci_dev *hdev, __u16 handle);
584584

585585
struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
586586
__u8 dst_type, __u8 sec_level, __u8 auth_type);
587+
struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type,
588+
bdaddr_t *dst);
587589
int hci_conn_check_link_mode(struct hci_conn *conn);
588590
int hci_conn_check_secure(struct hci_conn *conn, __u8 sec_level);
589591
int hci_conn_security(struct hci_conn *conn, __u8 sec_level, __u8 auth_type);

net/bluetooth/hci_conn.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -560,13 +560,12 @@ static struct hci_conn *hci_connect_acl(struct hci_dev *hdev, bdaddr_t *dst,
560560
return acl;
561561
}
562562

563-
static struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type,
564-
bdaddr_t *dst, u8 sec_level, u8 auth_type)
563+
struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst)
565564
{
566565
struct hci_conn *acl;
567566
struct hci_conn *sco;
568567

569-
acl = hci_connect_acl(hdev, dst, sec_level, auth_type);
568+
acl = hci_connect_acl(hdev, dst, BT_SECURITY_LOW, HCI_AT_NO_BONDING);
570569
if (IS_ERR(acl))
571570
return acl;
572571

@@ -612,9 +611,6 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst,
612611
return hci_connect_le(hdev, dst, dst_type, sec_level, auth_type);
613612
case ACL_LINK:
614613
return hci_connect_acl(hdev, dst, sec_level, auth_type);
615-
case SCO_LINK:
616-
case ESCO_LINK:
617-
return hci_connect_sco(hdev, type, dst, sec_level, auth_type);
618614
}
619615

620616
return ERR_PTR(-EINVAL);

net/bluetooth/sco.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ static int sco_connect(struct sock *sk)
176176
else
177177
type = SCO_LINK;
178178

179-
hcon = hci_connect(hdev, type, dst, BDADDR_BREDR, BT_SECURITY_LOW,
180-
HCI_AT_NO_BONDING);
179+
hcon = hci_connect_sco(hdev, type, dst);
181180
if (IS_ERR(hcon)) {
182181
err = PTR_ERR(hcon);
183182
goto done;

0 commit comments

Comments
 (0)