]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
Bluetooth: Make hci-destruct callback optional
authorDavid Herrmann <dh.herrmann@googlemail.com>
Sat, 7 Jan 2012 14:47:07 +0000 (15:47 +0100)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 13 Feb 2012 15:01:22 +0000 (17:01 +0200)
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>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_core.c

index 25a6c3fd7d1a465a4843a405fa68ec4c136dc0e4..86c74cc563ff7bec700c73ef2b8b2c01c97e5526 100644 (file)
@@ -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);
+       }
 }
 
 /*
index f84935e5cbabe5dd3632f3f1bd8b292751573f80..f23e32a645c8881f97c2819ddc90ac13278cdf26 100644 (file)
@@ -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,