Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1466165 > unrolled thread
| Started by | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| First post | 2016-08-19 09:40 +0200 |
| Last post | 2016-08-19 09:40 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH 4/4] Bluetooth: hci_ldisc: make sure we don't loose HCI_UART_TX_WAKEUP events Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-08-19 09:40 +0200
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-08-19 09:40 +0200 |
| Subject | [PATCH 4/4] Bluetooth: hci_ldisc: make sure we don't loose HCI_UART_TX_WAKEUP events |
| Message-ID | <s7Mzf-2Fi-17@gated-at.bofh.it> |
The HCI_UART_TX_WAKEUP flag checking is racy and some HCI_UART_TX_WAKEUP events can be lost. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> --- drivers/bluetooth/hci_ldisc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c index 27f73294edcb..ee7b25f1c6ce 100644 --- a/drivers/bluetooth/hci_ldisc.c +++ b/drivers/bluetooth/hci_ldisc.c @@ -172,6 +172,17 @@ restart: goto restart; clear_bit(HCI_UART_SENDING, &hu->tx_state); + + /* + * One last check to make sure hci_uart_tx_wakeup() did not set + * HCI_UART_TX_WAKEUP while we where clearing HCI_UART_SENDING. + * The work might have been scheduled by someone else in the + * meantime, in this case we return directly. + */ + if (test_bit(HCI_UART_TX_WAKEUP, &hu->tx_state) && + !test_and_set_bit(HCI_UART_SENDING, &hu->tx_state)) + goto restart; + } static void hci_uart_init_work(struct work_struct *work) -- 2.7.4
Back to top | Article view | linux.kernel
csiph-web