Skip to content

Commit a44fecb

Browse files
tedd-anholtmann
authored andcommitted
Bluetooth: Add shutdown callback before closing the device
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>
1 parent 3e544ef commit a44fecb

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

‎include/net/bluetooth/hci_core.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ struct hci_dev {
373373
int (*close)(struct hci_dev *hdev);
374374
int (*flush)(struct hci_dev *hdev);
375375
int (*setup)(struct hci_dev *hdev);
376+
int (*shutdown)(struct hci_dev *hdev);
376377
int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
377378
void (*notify)(struct hci_dev *hdev, unsigned int evt);
378379
void (*hw_error)(struct hci_dev *hdev, u8 code);

‎net/bluetooth/hci_core.c‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1591,6 +1591,12 @@ static int hci_dev_do_close(struct hci_dev *hdev)
15911591
{
15921592
BT_DBG("%s %p", hdev->name, hdev);
15931593

1594+
if (!test_bit(HCI_UNREGISTER, &hdev->dev_flags)) {
1595+
/* Execute vendor specific shutdown routine */
1596+
if (hdev->shutdown)
1597+
hdev->shutdown(hdev);
1598+
}
1599+
15941600
cancel_delayed_work(&hdev->power_off);
15951601

15961602
hci_req_cancel(hdev, ENODEV);

0 commit comments

Comments
 (0)