Bluetooth: Track feature pages in a single table
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / bluetooth / hci_sock.c
index 07f073935811b86292136a59ecb544d323d3ea86..aa4354fca77c76b2282f81d86114c2698088d273 100644 (file)
@@ -70,14 +70,13 @@ static struct bt_sock_list hci_sk_list = {
 void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct sock *sk;
-       struct hlist_node *node;
        struct sk_buff *skb_copy = NULL;
 
        BT_DBG("hdev %p len %d", hdev, skb->len);
 
        read_lock(&hci_sk_list.lock);
 
-       sk_for_each(sk, node, &hci_sk_list.head) {
+       sk_for_each(sk, &hci_sk_list.head) {
                struct hci_filter *flt;
                struct sk_buff *nskb;
 
@@ -142,13 +141,12 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb)
 void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk)
 {
        struct sock *sk;
-       struct hlist_node *node;
 
        BT_DBG("len %d", skb->len);
 
        read_lock(&hci_sk_list.lock);
 
-       sk_for_each(sk, node, &hci_sk_list.head) {
+       sk_for_each(sk, &hci_sk_list.head) {
                struct sk_buff *nskb;
 
                /* Skip the original socket */
@@ -176,7 +174,6 @@ void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk)
 void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct sock *sk;
-       struct hlist_node *node;
        struct sk_buff *skb_copy = NULL;
        __le16 opcode;
 
@@ -210,7 +207,7 @@ void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb)
 
        read_lock(&hci_sk_list.lock);
 
-       sk_for_each(sk, node, &hci_sk_list.head) {
+       sk_for_each(sk, &hci_sk_list.head) {
                struct sk_buff *nskb;
 
                if (sk->sk_state != BT_BOUND)
@@ -251,13 +248,12 @@ void hci_send_to_monitor(struct hci_dev *hdev, struct sk_buff *skb)
 static void send_monitor_event(struct sk_buff *skb)
 {
        struct sock *sk;
-       struct hlist_node *node;
 
        BT_DBG("len %d", skb->len);
 
        read_lock(&hci_sk_list.lock);
 
-       sk_for_each(sk, node, &hci_sk_list.head) {
+       sk_for_each(sk, &hci_sk_list.head) {
                struct sk_buff *nskb;
 
                if (sk->sk_state != BT_BOUND)
@@ -393,11 +389,10 @@ void hci_sock_dev_event(struct hci_dev *hdev, int event)
 
        if (event == HCI_DEV_UNREG) {
                struct sock *sk;
-               struct hlist_node *node;
 
                /* Detach sockets from device */
                read_lock(&hci_sk_list.lock);
-               sk_for_each(sk, node, &hci_sk_list.head) {
+               sk_for_each(sk, &hci_sk_list.head) {
                        bh_lock_sock_nested(sk);
                        if (hci_pi(sk)->hdev == hdev) {
                                hci_pi(sk)->hdev = NULL;
@@ -859,6 +854,11 @@ static int hci_sock_sendmsg(struct kiocb *iocb, struct socket *sock,
                        skb_queue_tail(&hdev->raw_q, skb);
                        queue_work(hdev->workqueue, &hdev->tx_work);
                } else {
+                       /* Stand-alone HCI commands must be flaged as
+                        * single-command requests.
+                        */
+                       bt_cb(skb)->req.start = true;
+
                        skb_queue_tail(&hdev->cmd_q, skb);
                        queue_work(hdev->workqueue, &hdev->cmd_work);
                }
@@ -1126,8 +1126,6 @@ error:
 void hci_sock_cleanup(void)
 {
        bt_procfs_cleanup(&init_net, "hci");
-       if (bt_sock_unregister(BTPROTO_HCI) < 0)
-               BT_ERR("HCI socket unregistration failed");
-
+       bt_sock_unregister(BTPROTO_HCI);
        proto_unregister(&hci_sk_proto);
 }