Skip to content

Commit

Permalink
Bluetooth: Make hci-destruct callback optional
Browse files Browse the repository at this point in the history
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: David Herrmann <dh.herrmann@googlemail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
David Herrmann authored and Johan Hedberg committed Feb 13, 2012
1 parent 5a0b815 commit 010666a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions include/net/bluetooth/hci_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,10 @@ static inline void hci_conn_put(struct hci_conn *conn)
/* ----- HCI Devices ----- */
static inline void __hci_dev_put(struct hci_dev *d)
{
if (atomic_dec_and_test(&d->refcnt))
d->destruct(d);
if (atomic_dec_and_test(&d->refcnt)) {
if (d->destruct)
d->destruct(d);
}
}

/*
Expand Down
2 changes: 1 addition & 1 deletion net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,7 @@ int hci_register_dev(struct hci_dev *hdev)
BT_DBG("%p name %s bus %d owner %p", hdev, hdev->name,
hdev->bus, hdev->owner);

if (!hdev->open || !hdev->close || !hdev->destruct)
if (!hdev->open || !hdev->close)
return -EINVAL;

/* Do not allow HCI_AMP devices to register at index 0,
Expand Down

0 comments on commit 010666a

Please sign in to comment.