diff options
author | Ian Molton <ian@mnementh.co.uk> | 2017-07-08 17:37:41 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2017-07-20 11:18:36 +0200 |
commit | c34dc3bfa7642fda423208579015d615f7becfa0 (patch) | |
tree | 9e5dd5bfe190ba5eb4cc5f6c1e1d980a026f45af /drivers/bluetooth/hci_serdev.c | |
parent | fd865802c66bc451dc515ed89360f84376ce1a56 (diff) |
Bluetooth: hci_serdev: Introduce hci_uart_unregister_device()
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>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/hci_serdev.c')
-rw-r--r-- | drivers/bluetooth/hci_serdev.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c index aea930101dd2..b725ac4f7ff6 100644 --- a/drivers/bluetooth/hci_serdev.c +++ b/drivers/bluetooth/hci_serdev.c @@ -354,3 +354,16 @@ err_alloc: 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); |