Commit 010666a1 authored by David Herrmann's avatar David Herrmann Committed by Johan Hedberg

Bluetooth: Make hci-destruct callback optional

Several drivers already provide an empty callback so we can actually
make this optional and then remove all those empty callbacks in the
drivers.

This callback isn't needed at all by most drivers as they can remove
their allocated structures on device disconnect and not on hci
destruction.
Signed-off-by: default avatarDavid Herrmann <dh.herrmann@googlemail.com>
Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 5a0b8159
...@@ -595,8 +595,10 @@ static inline void hci_conn_put(struct hci_conn *conn) ...@@ -595,8 +595,10 @@ static inline void hci_conn_put(struct hci_conn *conn)
/* ----- HCI Devices ----- */ /* ----- HCI Devices ----- */
static inline void __hci_dev_put(struct hci_dev *d) static inline void __hci_dev_put(struct hci_dev *d)
{ {
if (atomic_dec_and_test(&d->refcnt)) if (atomic_dec_and_test(&d->refcnt)) {
if (d->destruct)
d->destruct(d); d->destruct(d);
}
} }
/* /*
......
...@@ -1551,7 +1551,7 @@ int hci_register_dev(struct hci_dev *hdev) ...@@ -1551,7 +1551,7 @@ int hci_register_dev(struct hci_dev *hdev)
BT_DBG("%p name %s bus %d owner %p", hdev, hdev->name, BT_DBG("%p name %s bus %d owner %p", hdev, hdev->name,
hdev->bus, hdev->owner); hdev->bus, hdev->owner);
if (!hdev->open || !hdev->close || !hdev->destruct) if (!hdev->open || !hdev->close)
return -EINVAL; return -EINVAL;
/* Do not allow HCI_AMP devices to register at index 0, /* Do not allow HCI_AMP devices to register at index 0,
......
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