diff options
author | Tedd Ho-Jeong An <tedd.an@intel.com> | 2015-02-13 12:20:50 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-02-14 18:37:52 -0500 |
commit | a44fecbd52a4d9c36f07eb2161c153047d8765d4 (patch) | |
tree | e03e5cbcc55e42fea5bb811cd40933e56d90e406 | |
parent | 3e544ef9357493422909064de35f3e289d92f1fe (diff) |
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>
-rw-r--r-- | include/net/bluetooth/hci_core.h | 1 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 52863c3e0b13..5f1ca3359c1a 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h | |||
@@ -373,6 +373,7 @@ struct hci_dev { | |||
373 | int (*close)(struct hci_dev *hdev); | 373 | int (*close)(struct hci_dev *hdev); |
374 | int (*flush)(struct hci_dev *hdev); | 374 | int (*flush)(struct hci_dev *hdev); |
375 | int (*setup)(struct hci_dev *hdev); | 375 | int (*setup)(struct hci_dev *hdev); |
376 | int (*shutdown)(struct hci_dev *hdev); | ||
376 | int (*send)(struct hci_dev *hdev, struct sk_buff *skb); | 377 | int (*send)(struct hci_dev *hdev, struct sk_buff *skb); |
377 | void (*notify)(struct hci_dev *hdev, unsigned int evt); | 378 | void (*notify)(struct hci_dev *hdev, unsigned int evt); |
378 | void (*hw_error)(struct hci_dev *hdev, u8 code); | 379 | void (*hw_error)(struct hci_dev *hdev, u8 code); |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 3322d3f4c85a..4135a4406aed 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1591,6 +1591,12 @@ static int hci_dev_do_close(struct hci_dev *hdev) | |||
1591 | { | 1591 | { |
1592 | BT_DBG("%s %p", hdev->name, hdev); | 1592 | BT_DBG("%s %p", hdev->name, hdev); |
1593 | 1593 | ||
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 | |||
1594 | cancel_delayed_work(&hdev->power_off); | 1600 | cancel_delayed_work(&hdev->power_off); |
1595 | 1601 | ||
1596 | hci_req_cancel(hdev, ENODEV); | 1602 | hci_req_cancel(hdev, ENODEV); |