diff options
| author | Frédéric Dalleau <frederic.dalleau@linux.intel.com> | 2013-04-16 11:28:58 -0400 |
|---|---|---|
| committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-04-17 23:17:54 -0400 |
| commit | fa5513be2b709c8ce6ff0b11d0715760a9a70ffd (patch) | |
| tree | 8415b7ab631e06c523133b192849b14dbc5ed233 | |
| parent | bbb0eada826636f658ce49290d2896aead5515f7 (diff) | |
Bluetooth: Move and rename hci_conn_accept
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>
| -rw-r--r-- | include/net/bluetooth/hci_core.h | 1 | ||||
| -rw-r--r-- | net/bluetooth/hci_event.c | 36 | ||||
| -rw-r--r-- | net/bluetooth/sco.c | 38 |
3 files changed, 37 insertions, 38 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index d324b11a0c8f..74f77b7ef136 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
| @@ -583,7 +583,6 @@ struct hci_conn *hci_conn_add(struct hci_dev *hdev, int type, bdaddr_t *dst); | |||
| 583 | int hci_conn_del(struct hci_conn *conn); | 583 | int hci_conn_del(struct hci_conn *conn); |
| 584 | void hci_conn_hash_flush(struct hci_dev *hdev); | 584 | void hci_conn_hash_flush(struct hci_dev *hdev); |
| 585 | void hci_conn_check_pending(struct hci_dev *hdev); | 585 | void hci_conn_check_pending(struct hci_dev *hdev); |
| 586 | void hci_conn_accept(struct hci_conn *conn, int mask); | ||
| 587 | 586 | ||
| 588 | struct hci_chan *hci_chan_create(struct hci_conn *conn); | 587 | struct hci_chan *hci_chan_create(struct hci_conn *conn); |
| 589 | void hci_chan_del(struct hci_chan *chan); | 588 | void hci_chan_del(struct hci_chan *chan); |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 6fa909075ceb..e4d4d231fd8a 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
| @@ -1752,42 +1752,6 @@ unlock: | |||
| 1752 | hci_conn_check_pending(hdev); | 1752 | hci_conn_check_pending(hdev); |
| 1753 | } | 1753 | } |
| 1754 | 1754 | ||
| 1755 | void hci_conn_accept(struct hci_conn *conn, int mask) | ||
| 1756 | { | ||
| 1757 | struct hci_dev *hdev = conn->hdev; | ||
| 1758 | |||
| 1759 | BT_DBG("conn %p", conn); | ||
| 1760 | |||
| 1761 | conn->state = BT_CONFIG; | ||
| 1762 | |||
| 1763 | if (!lmp_esco_capable(hdev)) { | ||
| 1764 | struct hci_cp_accept_conn_req cp; | ||
| 1765 | |||
| 1766 | bacpy(&cp.bdaddr, &conn->dst); | ||
| 1767 | |||
| 1768 | if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER)) | ||
| 1769 | cp.role = 0x00; /* Become master */ | ||
| 1770 | else | ||
| 1771 | cp.role = 0x01; /* Remain slave */ | ||
| 1772 | |||
| 1773 | hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp); | ||
| 1774 | } else /* lmp_esco_capable(hdev)) */ { | ||
| 1775 | struct hci_cp_accept_sync_conn_req cp; | ||
| 1776 | |||
| 1777 | bacpy(&cp.bdaddr, &conn->dst); | ||
| 1778 | cp.pkt_type = cpu_to_le16(conn->pkt_type); | ||
| 1779 | |||
| 1780 | cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40); | ||
| 1781 | cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40); | ||
| 1782 | cp.max_latency = __constant_cpu_to_le16(0xffff); | ||
| 1783 | cp.content_format = cpu_to_le16(hdev->voice_setting); | ||
| 1784 | cp.retrans_effort = 0xff; | ||
| 1785 | |||
| 1786 | hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, | ||
| 1787 | sizeof(cp), &cp); | ||
| 1788 | } | ||
| 1789 | } | ||
| 1790 | |||
| 1791 | static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) | 1755 | static void hci_conn_request_evt(struct hci_dev *hdev, struct sk_buff *skb) |
| 1792 | { | 1756 | { |
| 1793 | struct hci_ev_conn_request *ev = (void *) skb->data; | 1757 | struct hci_ev_conn_request *ev = (void *) skb->data; |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index d8836802526c..9e62102443dc 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
| @@ -652,6 +652,42 @@ static int sco_sock_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
| 652 | return err; | 652 | return err; |
| 653 | } | 653 | } |
| 654 | 654 | ||
| 655 | static void sco_conn_defer_accept(struct hci_conn *conn, int mask) | ||
| 656 | { | ||
| 657 | struct hci_dev *hdev = conn->hdev; | ||
| 658 | |||
| 659 | BT_DBG("conn %p", conn); | ||
| 660 | |||
| 661 | conn->state = BT_CONFIG; | ||
| 662 | |||
| 663 | if (!lmp_esco_capable(hdev)) { | ||
| 664 | struct hci_cp_accept_conn_req cp; | ||
| 665 | |||
| 666 | bacpy(&cp.bdaddr, &conn->dst); | ||
| 667 | |||
| 668 | if (lmp_rswitch_capable(hdev) && (mask & HCI_LM_MASTER)) | ||
| 669 | cp.role = 0x00; /* Become master */ | ||
| 670 | else | ||
| 671 | cp.role = 0x01; /* Remain slave */ | ||
| 672 | |||
| 673 | hci_send_cmd(hdev, HCI_OP_ACCEPT_CONN_REQ, sizeof(cp), &cp); | ||
| 674 | } else { | ||
| 675 | struct hci_cp_accept_sync_conn_req cp; | ||
| 676 | |||
| 677 | bacpy(&cp.bdaddr, &conn->dst); | ||
| 678 | cp.pkt_type = cpu_to_le16(conn->pkt_type); | ||
| 679 | |||
| 680 | cp.tx_bandwidth = __constant_cpu_to_le32(0x00001f40); | ||
| 681 | cp.rx_bandwidth = __constant_cpu_to_le32(0x00001f40); | ||
| 682 | cp.max_latency = __constant_cpu_to_le16(0xffff); | ||
| 683 | cp.content_format = cpu_to_le16(hdev->voice_setting); | ||
| 684 | cp.retrans_effort = 0xff; | ||
| 685 | |||
| 686 | hci_send_cmd(hdev, HCI_OP_ACCEPT_SYNC_CONN_REQ, | ||
| 687 | sizeof(cp), &cp); | ||
| 688 | } | ||
| 689 | } | ||
| 690 | |||
| 655 | static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | 691 | static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock, |
| 656 | struct msghdr *msg, size_t len, int flags) | 692 | struct msghdr *msg, size_t len, int flags) |
| 657 | { | 693 | { |
| @@ -662,7 +698,7 @@ static int sco_sock_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
| 662 | 698 | ||
| 663 | if (sk->sk_state == BT_CONNECT2 && | 699 | if (sk->sk_state == BT_CONNECT2 && |
| 664 | test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) { | 700 | test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags)) { |
| 665 | hci_conn_accept(pi->conn->hcon, 0); | 701 | sco_conn_defer_accept(pi->conn->hcon, 0); |
| 666 | sk->sk_state = BT_CONFIG; | 702 | sk->sk_state = BT_CONFIG; |
| 667 | 703 | ||
| 668 | release_sock(sk); | 704 | release_sock(sk); |
