Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd7666f6 authored by Anantha Krishnan's avatar Anantha Krishnan Committed by Gerrit - the friendly Code Review server
Browse files

bluetooth: hci_ibs: disable irqs when spinlock is acquired



Deadlock is observed while performing bluetooth stress and
stability tests. Since same lock is getting acquired from both irq
and non-irq context, irqs should be disable while acquiring
the spinlock always. Otherwise there is chance of deadlock
observing while performing stability tests

Change-Id: I6921e7ed70362e1cbdc3f90543e0c906bab8f385
Signed-off-by: default avatarAnantha Krishnan <ananthk@codeaurora.org>
parent 50e0173f
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -249,13 +249,14 @@ static void ibs_wq_awake_device(struct work_struct *work)
	struct ibs_struct *ibs = container_of(work, struct ibs_struct,
					ws_awake_device);
	struct hci_uart *hu = (struct hci_uart *)ibs->ibs_hu;
	unsigned long flags;

	BT_DBG(" %p ", hu);

	/* Vote for serial clock */
	ibs_msm_serial_clock_vote(HCI_IBS_TX_VOTE_CLOCK_ON, hu);

	spin_lock(&ibs->hci_ibs_lock);
	spin_lock_irqsave(&ibs->hci_ibs_lock, flags);

	/* send wake indication to device */
	if (send_hci_ibs_cmd(HCI_IBS_WAKE_IND, hu) < 0)
@@ -266,7 +267,8 @@ static void ibs_wq_awake_device(struct work_struct *work)
	/* start retransmit timer */
	mod_timer(&ibs->wake_retrans_timer, jiffies + wake_retrans);

	spin_unlock(&ibs->hci_ibs_lock);
	spin_unlock_irqrestore(&ibs->hci_ibs_lock, flags);

}

static void ibs_wq_awake_rx(struct work_struct *work)
@@ -274,12 +276,14 @@ static void ibs_wq_awake_rx(struct work_struct *work)
	struct ibs_struct *ibs = container_of(work, struct ibs_struct,
					ws_awake_rx);
	struct hci_uart *hu = (struct hci_uart *)ibs->ibs_hu;
	unsigned long flags;

	BT_DBG(" %p ", hu);

	ibs_msm_serial_clock_vote(HCI_IBS_RX_VOTE_CLOCK_ON, hu);

	spin_lock(&ibs->hci_ibs_lock);
	spin_lock_irqsave(&ibs->hci_ibs_lock, flags);

	ibs->rx_ibs_state = HCI_IBS_RX_AWAKE;
	/* Always acknowledge device wake up,
	 * sending IBS message doesn't count as TX ON
@@ -289,7 +293,8 @@ static void ibs_wq_awake_rx(struct work_struct *work)

	ibs->ibs_sent_wacks++; /* debug */

	spin_unlock(&ibs->hci_ibs_lock);
	spin_unlock_irqrestore(&ibs->hci_ibs_lock, flags);

	/* actually send the packets */
	hci_uart_tx_wakeup(hu);