From: Dean Jenkins <Dean_Jenkins@mentor.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: Dean Jenkins <Dean_Jenkins@mentor.com>,
"Gustavo F . Padovan" <gustavo@padovan.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
<linux-bluetooth@vger.kernel.org>
Subject: [PATCH V2 15/16] Bluetooth: hci_ldisc: Simplify flushing
Date: Fri, 7 Apr 2017 18:04:37 +0100 [thread overview]
Message-ID: <1491584678-27228-16-git-send-email-Dean_Jenkins@mentor.com> (raw)
In-Reply-To: <1491584678-27228-1-git-send-email-Dean_Jenkins@mentor.com>
The flushing due to the hci_uart_close() call probably corrupts the
data flow between the Data Link protocol layer and the UART port
(transmission direction). In any case, the flushing activity is
asynchronous to the state of the Data Link protocol layer so is
undesirable.
Modify hci_uart_close() to not perform any flushing because
hci_uart_flush() is explicitly called in hci_dev_do_close() which
is synchronous to the closure of the Data Link protocol layer so
it is OK. In other words, there is no point in flushing multiple
times with the Data Link protocol layer being in the bound state.
In hci_uart_tty_close() call hci_uart_flush() instead of
hci_uart_close() before freeing hdev. This final flush is after the
Data Link protocol layer has been unbound so ensures that the
transmission path is empty.
Signed-off-by: Dean Jenkins <Dean_Jenkins@mentor.com>
---
drivers/bluetooth/hci_ldisc.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c
index fbf830a..ec9b96f 100644
--- a/drivers/bluetooth/hci_ldisc.c
+++ b/drivers/bluetooth/hci_ldisc.c
@@ -256,8 +256,7 @@ static int hci_uart_close(struct hci_dev *hdev)
{
BT_DBG("hdev %p", hdev);
- hci_uart_flush(hdev);
- hdev->flush = NULL;
+ /* Nothing to do for UART driver */
return 0;
}
@@ -538,7 +537,7 @@ static void hci_uart_tty_close(struct tty_struct *tty)
clear_bit(HCI_UART_PROTO_SET, &hu->flags);
if (test_and_clear_bit(HCI_UART_REGISTERED, &hu->flags)) {
- hci_uart_close(hdev);
+ hci_uart_flush(hdev);
hu->hdev = NULL;
hci_free_dev(hdev);
}
--
2.7.4
next prev parent reply other threads:[~2017-04-07 17:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-07 17:04 [PATCH V2 00/16] hci_ldisc hci_uart_tty_close() fixes Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 01/16] Bluetooth: hci_ldisc: Add missing return in hci_uart_init_work() Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 02/16] Bluetooth: hci_ldisc: Ensure hu->hdev set to NULL before freeing hdev Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 03/16] Bluetooth: hci_ldisc: Add missing clear HCI_UART_PROTO_READY Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 04/16] Bluetooth: hci_ldisc: Add HCI RESET comment to hci_unregister_dev() call Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 05/16] Bluetooth: hci_ldisc: Separate flag handling in hci_uart_tty_close() Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 06/16] Bluetooth: hci_ldisc: Add protocol check to hci_uart_send_frame() Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 07/16] Bluetooth: hci_ldisc: Add protocol check to hci_uart_dequeue() Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 08/16] Bluetooth: hci_ldisc: Add protocol check to hci_uart_tx_wakeup() Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 09/16] Bluetooth: hci_ldisc: Use rwlocking to avoid closing proto races Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 10/16] Bluetooth: hci_ldisc: Tidy-up HCI_UART_REGISTERED in hci_uart_tty_close() Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 11/16] Bluetooth: hci_ldisc: hci_uart_tty_close() move hci_uart_close() Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 12/16] Bluetooth: hci_ldisc: hci_uart_tty_close() detach tty after last msg Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 13/16] Bluetooth: hci_ldisc: hci_uart_tty_close() move cancel_work_sync() Dean Jenkins
2017-04-07 17:04 ` [PATCH V2 14/16] Bluetooth: hci_ldisc: hci_uart_tty_close() free hu->tx_skb Dean Jenkins
2017-04-07 17:04 ` Dean Jenkins [this message]
2017-04-07 17:04 ` [PATCH V2 16/16] Bluetooth: hci_ldisc: Add ioctl_mutex avoiding concurrency Dean Jenkins
2017-04-12 9:13 ` [PATCH V2 00/16] hci_ldisc hci_uart_tty_close() fixes Dean Jenkins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1491584678-27228-16-git-send-email-Dean_Jenkins@mentor.com \
--to=dean_jenkins@mentor.com \
--cc=gustavo@padovan.org \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox