Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a44fecbd authored by Tedd Ho-Jeong An's avatar Tedd Ho-Jeong An Committed by Marcel Holtmann
Browse files

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: default avatarTedd Ho-Jeong An <tedd.an@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 3e544ef9
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -373,6 +373,7 @@ struct hci_dev {
	int (*close)(struct hci_dev *hdev);
	int (*close)(struct hci_dev *hdev);
	int (*flush)(struct hci_dev *hdev);
	int (*flush)(struct hci_dev *hdev);
	int (*setup)(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);
	int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
	void (*notify)(struct hci_dev *hdev, unsigned int evt);
	void (*notify)(struct hci_dev *hdev, unsigned int evt);
	void (*hw_error)(struct hci_dev *hdev, u8 code);
	void (*hw_error)(struct hci_dev *hdev, u8 code);
+6 −0
Original line number Original line Diff line number Diff line
@@ -1591,6 +1591,12 @@ static int hci_dev_do_close(struct hci_dev *hdev)
{
{
	BT_DBG("%s %p", hdev->name, 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);
	cancel_delayed_work(&hdev->power_off);


	hci_req_cancel(hdev, ENODEV);
	hci_req_cancel(hdev, ENODEV);