]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
Bluetooth: Move and rename hci_conn_accept
authorFrédéric Dalleau <frederic.dalleau@linux.intel.com>
Tue, 16 Apr 2013 15:28:58 +0000 (17:28 +0200)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Thu, 18 Apr 2013 03:17:54 +0000 (00:17 -0300)
Since this function is only used by sco, move it from hci_event.c to
sco.c and rename to sco_conn_defer_accept. Make it static.

Signed-off-by: Frédéric Dalleau <frederic.dalleau@linux.intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_event.c
net/bluetooth/sco.c

index d324b11a0c8f3368f5cfa7c9d48740a8844abfa2..74f77b7ef136f3a89a23c651814cc4321d5af345 100644 (file)
@@ -583,7 +583,6 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst);
 int hci_conn_del(struct hci_conn *conn);
 void hci_conn_hash_flush(struct hci_dev *hdev);
 void hci_conn_check_pending(struct hci_dev *hdev);
-void hci_conn_accept(struct hci_conn *conn, int mask);
 
 struct hci_chan *hci_chan_create(struct hci_conn *conn);
 void hci_chan_del(struct hci_chan *chan);
index 6fa909075cebf9c2a88edd7d69327c7afb6c7e0b..e4d4d231fd8af11f6e60faa6b423ce032f7f9687 100644 (file)
@@ -1752,42 +1752,6 @@ unlock:
        hci_conn_check_pending(hdev);
 }
 
-void hci_conn_accept(struct hci_conn *conn, int mask)
-{
-       struct hci_dev *hdev = conn->hdev;
-
-       BT_DBG("conn %p", conn);
-
-       conn->state = BT_CONFIG;
-
-       if (!lmp_esco_capable(hdev)) {
-               struct hci_cp_accept_conn_req cp;
-
-               bacpy(&cp.bdaddr, &conn->dst);
-
-               if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER))
-                       cp.role = 0x00; /* Become master */
-               else
-                       cp.role = 0x01; /* Remain slave */
-
-               hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp);
-       } else /* lmp_esco_capable(hdev)) */ {
-               struct hci_cp_accept_sync_conn_req cp;
-
-               bacpy(&cp.bdaddr, &conn->dst);
-               cp.pkt_type = cpu_to_le16(conn->pkt_type);
-
-               cp.tx_bandwidth   = __constant_cpu_to_le32(0x00001f40);
-               cp.rx_bandwidth   = __constant_cpu_to_le32(0x00001f40);
-               cp.max_latency    = __constant_cpu_to_le16(0xffff);
-               cp.content_format = cpu_to_le16(hdev->voice_setting);
-               cp.retrans_effort = 0xff;
-
-               hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ,
-                            sizeof(cp), &cp);
-       }
-}
-
 static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct hci_ev_conn_request *ev = (void *) skb->data;
index d8836802526c05308e34ce92154e0f7c0c1b7628..9e62102443dc79a408feed50d9db48576422fd5c 100644 (file)
@@ -652,6 +652,42 @@ static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
        return err;
 }
 
+static void sco_conn_defer_accept(struct hci_conn *conn, int mask)
+{
+       struct hci_dev *hdev = conn->hdev;
+
+       BT_DBG("conn %p", conn);
+
+       conn->state = BT_CONFIG;
+
+       if (!lmp_esco_capable(hdev)) {
+               struct hci_cp_accept_conn_req cp;
+
+               bacpy(&cp.bdaddr, &conn->dst);
+
+               if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER))
+                       cp.role = 0x00; /* Become master */
+               else
+                       cp.role = 0x01; /* Remain slave */
+
+               hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp);
+       } else {
+               struct hci_cp_accept_sync_conn_req cp;
+
+               bacpy(&cp.bdaddr, &conn->dst);
+               cp.pkt_type = cpu_to_le16(conn->pkt_type);
+
+               cp.tx_bandwidth   = __constant_cpu_to_le32(0x00001f40);
+               cp.rx_bandwidth   = __constant_cpu_to_le32(0x00001f40);
+               cp.max_latency    = __constant_cpu_to_le16(0xffff);
+               cp.content_format = cpu_to_le16(hdev->voice_setting);
+               cp.retrans_effort = 0xff;
+
+               hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ,
+                            sizeof(cp), &cp);
+       }
+}
+
 static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
                            struct msghdr *msg, size_t len, int flags)
 {
@@ -662,7 +698,7 @@ static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
 
        if (sk->sk_state == BT_CONNECT2 &&
            test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) {
-               hci_conn_accept(pi->conn->hcon, 0);
+               sco_conn_defer_accept(pi->conn->hcon, 0);
                sk->sk_state = BT_CONFIG;
 
                release_sock(sk);