Bluetooth: btbcm: Read the local name in setup stage
[firefly-linux-kernel-4.4.55.git] / drivers / bluetooth / hci_ldisc.c
index 177dd69fdd954151c3742c5cf443d439ad0edc0c..01a83a3f8a1d1d603a93a1fd9810b61120438b9c 100644 (file)
@@ -208,9 +208,6 @@ static int hci_uart_open(struct hci_dev *hdev)
        BT_DBG("%s %p", hdev->name, hdev);
 
        /* Nothing to do for UART driver */
-
-       set_bit(HCI_RUNNING, &hdev->flags);
-
        return 0;
 }
 
@@ -241,9 +238,6 @@ static int hci_uart_close(struct hci_dev *hdev)
 {
        BT_DBG("hdev %p", hdev);
 
-       if (!test_and_clear_bit(HCI_RUNNING, &hdev->flags))
-               return 0;
-
        hci_uart_flush(hdev);
        hdev->flush = NULL;
        return 0;
@@ -254,9 +248,6 @@ static int hci_uart_send_frame(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct hci_uart *hu = hci_get_drvdata(hdev);
 
-       if (!test_bit(HCI_RUNNING, &hdev->flags))
-               return -EBUSY;
-
        BT_DBG("%s: type %d len %d", hdev->name, bt_cb(skb)->pkt_type, skb->len);
 
        hu->proto->enqueue(hu, skb);
@@ -470,8 +461,6 @@ static int hci_uart_tty_open(struct tty_struct *tty)
        INIT_WORK(&hu->init_ready, hci_uart_init_work);
        INIT_WORK(&hu->write_work, hci_uart_write_work);
 
-       spin_lock_init(&hu->rx_lock);
-
        /* Flush any pending characters in the driver and line discipline. */
 
        /* FIXME: why is this needed. Note don't use ldisc_ref here as the
@@ -569,14 +558,14 @@ static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data,
        if (!test_bit(HCI_UART_PROTO_SET, &hu->flags))
                return;
 
-       spin_lock(&hu->rx_lock);
+       /* It does not need a lock here as it is already protected by a mutex in
+        * tty caller
+        */
        hu->proto->recv(hu, data, count);
 
        if (hu->hdev)
                hu->hdev->stat.byte_rx += count;
 
-       spin_unlock(&hu->rx_lock);
-
        tty_unthrottle(tty);
 }
 
@@ -770,7 +759,7 @@ static int __init hci_uart_init(void)
 
        /* Register the tty discipline */
 
-       memset(&hci_uart_ldisc, 0, sizeof (hci_uart_ldisc));
+       memset(&hci_uart_ldisc, 0, sizeof(hci_uart_ldisc));
        hci_uart_ldisc.magic            = TTY_LDISC_MAGIC;
        hci_uart_ldisc.name             = "n_hci";
        hci_uart_ldisc.open             = hci_uart_tty_open;
@@ -804,9 +793,15 @@ static int __init hci_uart_init(void)
 #ifdef CONFIG_BT_HCIUART_3WIRE
        h5_init();
 #endif
+#ifdef CONFIG_BT_HCIUART_INTEL
+       intel_init();
+#endif
 #ifdef CONFIG_BT_HCIUART_BCM
        bcm_init();
 #endif
+#ifdef CONFIG_BT_HCIUART_QCA
+       qca_init();
+#endif
 
        return 0;
 }
@@ -830,9 +825,15 @@ static void __exit hci_uart_exit(void)
 #ifdef CONFIG_BT_HCIUART_3WIRE
        h5_deinit();
 #endif
+#ifdef CONFIG_BT_HCIUART_INTEL
+       intel_deinit();
+#endif
 #ifdef CONFIG_BT_HCIUART_BCM
        bcm_deinit();
 #endif
+#ifdef CONFIG_BT_HCIUART_QCA
+       qca_deinit();
+#endif
 
        /* Release tty registration of line discipline */
        err = tty_unregister_ldisc(N_HCI);