summaryrefslogtreecommitdiff
path: root/drivers/bluetooth/hci_serdev.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-05-27 22:04:52 +0300
committerMarcel Holtmann <marcel@holtmann.org>2018-05-30 09:47:42 +0300
commite9ca08074ddcdcc3abacbfca888dba3a110e4453 (patch)
tree8f7a3c087c647e3600d5b62bc98b15786e60e0bd /drivers/bluetooth/hci_serdev.c
parent412fe29ffcf9a1ba9f125e72ee3da957cd6a0064 (diff)
downloadlinux-e9ca08074ddcdcc3abacbfca888dba3a110e4453.tar.xz
Bluetooth: hci_serdev: Move serdev_device_close/open into common hci_serdev code
Make hci_uart_register_device() and hci_uart_unregister_device() call serdev_device_close()/open() themselves instead of relying on the various hci_uart drivers to do this for them. Besides reducing code complexity, this also ensures correct error checking of serdev_device_open(), which was missing in a few drivers. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/hci_serdev.c')
-rw-r--r--drivers/bluetooth/hci_serdev.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/bluetooth/hci_serdev.c b/drivers/bluetooth/hci_serdev.c
index 6a713f13f71c..7a3d6d636192 100644
--- a/drivers/bluetooth/hci_serdev.c
+++ b/drivers/bluetooth/hci_serdev.c
@@ -284,10 +284,14 @@ int hci_uart_register_device(struct hci_uart *hu,
serdev_device_set_client_ops(hu->serdev, &hci_serdev_client_ops);
- err = p->open(hu);
+ err = serdev_device_open(hu->serdev);
if (err)
return err;
+ err = p->open(hu);
+ if (err)
+ goto err_open;
+
hu->proto = p;
set_bit(HCI_UART_PROTO_READY, &hu->flags);
@@ -353,6 +357,8 @@ err_register:
err_alloc:
clear_bit(HCI_UART_PROTO_READY, &hu->flags);
p->close(hu);
+err_open:
+ serdev_device_close(hu->serdev);
return err;
}
EXPORT_SYMBOL_GPL(hci_uart_register_device);
@@ -367,5 +373,6 @@ void hci_uart_unregister_device(struct hci_uart *hu)
cancel_work_sync(&hu->write_work);
hu->proto->close(hu);
+ serdev_device_close(hu->serdev);
}
EXPORT_SYMBOL_GPL(hci_uart_unregister_device);