Commit c34dc3bf authored by Ian Molton's avatar Ian Molton Committed by Marcel Holtmann

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: default avatarIan Molton <ian@mnementh.co.uk>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent fd865802
...@@ -354,3 +354,16 @@ int hci_uart_register_device(struct hci_uart *hu, ...@@ -354,3 +354,16 @@ int hci_uart_register_device(struct hci_uart *hu,
return err; return err;
} }
EXPORT_SYMBOL_GPL(hci_uart_register_device); 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);
...@@ -112,6 +112,7 @@ struct hci_uart { ...@@ -112,6 +112,7 @@ struct hci_uart {
int hci_uart_register_proto(const struct hci_uart_proto *p); 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_unregister_proto(const struct hci_uart_proto *p);
int hci_uart_register_device(struct hci_uart *hu, 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_tx_wakeup(struct hci_uart *hu);
int hci_uart_init_ready(struct hci_uart *hu); int hci_uart_init_ready(struct hci_uart *hu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment