Merge "Bluetooth: Added spinlocks for serial_clock_vote"
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 0986c32..4c40fa2 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -231,11 +231,11 @@
BT_DBG("hu %p wq awake device", hu);
+ spin_lock(&qca->hci_ibs_lock);
+
/* Vote for serial clock */
serial_clock_vote(HCI_IBS_TX_VOTE_CLOCK_ON, hu);
- spin_lock(&qca->hci_ibs_lock);
-
/* Send wake indication to device */
if (send_hci_ibs_cmd(HCI_IBS_WAKE_IND, hu) < 0)
BT_ERR("Failed to send WAKE to device");
@@ -260,9 +260,10 @@
BT_DBG("hu %p wq awake rx", hu);
+ spin_lock(&qca->hci_ibs_lock);
+
serial_clock_vote(HCI_IBS_RX_VOTE_CLOCK_ON, hu);
- spin_lock(&qca->hci_ibs_lock);
qca->rx_ibs_state = HCI_IBS_RX_AWAKE;
/* Always acknowledge device wake up,
@@ -287,7 +288,11 @@
BT_DBG("hu %p rx clock vote off", hu);
+ spin_lock(&qca->hci_ibs_lock);
+
serial_clock_vote(HCI_IBS_RX_VOTE_CLOCK_OFF, hu);
+
+ spin_unlock(&qca->hci_ibs_lock);
}
static void qca_wq_serial_tx_clock_vote_off(struct work_struct *work)
@@ -298,6 +303,8 @@
BT_DBG("hu %p tx clock vote off", hu);
+ spin_lock(&qca->hci_ibs_lock);
+
/* Run HCI tx handling unlocked */
hci_uart_tx_wakeup(hu);
@@ -305,6 +312,8 @@
* It is up to the tty driver to pend the clocks off until tx done.
*/
serial_clock_vote(HCI_IBS_TX_VOTE_CLOCK_OFF, hu);
+
+ spin_unlock(&qca->hci_ibs_lock);
}
static void hci_ibs_tx_idle_timeout(unsigned long arg)
@@ -520,8 +529,12 @@
BT_DBG("hu %p qca close", hu);
+ spin_lock(&qca->hci_ibs_lock);
+
serial_clock_vote(HCI_IBS_VOTE_STATS_UPDATE, hu);
+ spin_unlock(&qca->hci_ibs_lock);
+
skb_queue_purge(&qca->tx_wait_q);
skb_queue_purge(&qca->txq);
del_timer(&qca->tx_idle_timer);