From: Ian Molton <ian@mnementh.co.uk>
To: linux-bluetooth@vger.kernel.org
Cc: sebastian.reichel@collabora.co.uk, marcel@holtmann.org,
ohad@bencohen.org
Subject: [PATCH 1/3] bluetooth: Introduce hci_uart_unregister_device()
Date: Sat, 8 Jul 2017 17:37:41 +0100 [thread overview]
Message-ID: <20170708163743.24394-2-ian@mnementh.co.uk> (raw)
In-Reply-To: <20170708163743.24394-1-ian@mnementh.co.uk>
Several drivers have the same (and incorrect) code in their
_remove() handler.
Coalesce this into a shared function.
Signed-off-by: Ian Molton <ian@mnementh.co.uk>
---
drivers/bluetooth/hci_serdev.c | 12 ++++++++++++
drivers/bluetooth/hci_uart.h | 1 +
2 files changed, 13 insertions(+)
diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c
index aea930101dd2..abc70b5e5647 100644
--- a/drivers/bluetooth/hci_serdev.c
+++ b/drivers/bluetooth/hci_serdev.c
@@ -354,3 +354,15 @@ int hci_uart_register_device(struct hci_uart *hu,
return err;
}
EXPORT_SYMBOL_GPL(hci_uart_register_device);
+
+void hci_uart_unregister_device(struct hci_uart *hu) {
+ struct hci_dev *hdev = hu->hdev;
+
+ hci_unregister_dev(hdev);
+ hci_free_dev(hdev);
+
+ cancel_work_sync(&hu->write_work);
+
+ hu->proto->close(hu);
+}
+EXPORT_SYMBOL_GPL(hci_uart_unregister_device);
diff --git a/drivers/bluetooth/hci_uart.h b/drivers/bluetooth/hci_uart.h
index c6e9e1cf63f8..d9cd95d81149 100644
--- a/drivers/bluetooth/hci_uart.h
+++ b/drivers/bluetooth/hci_uart.h
@@ -112,6 +112,7 @@ struct hci_uart {
int hci_uart_register_proto(const struct hci_uart_proto *p);
int hci_uart_unregister_proto(const struct hci_uart_proto *p);
int hci_uart_register_device(struct hci_uart *hu, const struct hci_uart_proto *p);
+void hci_uart_unregister_device(struct hci_uart *hu);
int hci_uart_tx_wakeup(struct hci_uart *hu);
int hci_uart_init_ready(struct hci_uart *hu);
--
2.11.0
next prev parent reply other threads:[~2017-07-08 16:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-08 16:37 PATCH (No really this time) - Fix hci_serdev drivers _remove() path Ian Molton
2017-07-08 16:37 ` Ian Molton [this message]
2017-07-08 19:31 ` [PATCH 1/3] bluetooth: Introduce hci_uart_unregister_device() Sebastian Reichel
2017-07-08 19:59 ` Marcel Holtmann
2017-07-09 8:46 ` Ian Molton
2017-07-08 16:37 ` [PATCH 2/3] bluetooth: Nokia: Use new hci_uart_unregister_device() function Ian Molton
2017-07-08 19:31 ` Sebastian Reichel
2017-07-08 16:37 ` [PATCH 3/3] bluetooth: hci_ll: " Ian Molton
2017-07-08 19:32 ` Sebastian Reichel
-- strict thread matches above, loose matches on Subject: below --
2017-07-08 14:29 Further _remove() cleanup for hci_uart drivers Ian Molton
2017-07-08 14:29 ` [PATCH 1/3] bluetooth: Introduce hci_uart_unregister_device() Ian Molton
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=20170708163743.24394-2-ian@mnementh.co.uk \
--to=ian@mnementh.co.uk \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=ohad@bencohen.org \
--cc=sebastian.reichel@collabora.co.uk \
/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