]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Bluetooth: Add shutdown callback before closing the device
authorTedd Ho-Jeong An <tedd.an@intel.com>
Fri, 13 Feb 2015 17:20:50 +0000 (09:20 -0800)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 14 Feb 2015 23:37:52 +0000 (00:37 +0100)
This callback allows a vendor to send the vendor specific commands
before cloing the hci interface.

Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci_core.h
net/bluetooth/hci_core.c

index 52863c3e0b132bc59224feef3f9e7acd678ef45a..5f1ca3359c1a666e707fed942fef9f3fcc7b4bc9 100644 (file)
@@ -373,6 +373,7 @@ struct hci_dev {
        int (*close)(struct hci_dev *hdev);
        int (*flush)(struct hci_dev *hdev);
        int (*setup)(struct hci_dev *hdev);
+       int (*shutdown)(struct hci_dev *hdev);
        int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
        void (*notify)(struct hci_dev *hdev, unsigned int evt);
        void (*hw_error)(struct hci_dev *hdev, u8 code);
index 3322d3f4c85a25eb4bed8dbfaa1802b907b3f1d3..4135a4406aedf79e1109313caf09a573dfa92dc8 100644 (file)
@@ -1591,6 +1591,12 @@ static int hci_dev_do_close(struct hci_dev *hdev)
 {
        BT_DBG("%s %p", hdev->name, hdev);
 
+       if (!test_bit(HCI_UNREGISTER, &hdev->dev_flags)) {
+               /* Execute vendor specific shutdown routine */
+               if (hdev->shutdown)
+                       hdev->shutdown(hdev);
+       }
+
        cancel_delayed_work(&hdev->power_off);
 
        hci_req_cancel(hdev, ENODEV);