提交 4a3f95b7 编写于 作者: M Marcel Holtmann 提交者: Johan Hedberg

Bluetooth: Introduce HCI_DEV_OPEN and HCI_DEV_CLOSE events

When opening the HCI transport via hdev->open send HCI_DEV_OPEN event
and when closing the HCI transport via hdev->close send HCI_DEV_CLOSE.
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
上级 ed1b28a4
...@@ -44,6 +44,8 @@ ...@@ -44,6 +44,8 @@
#define HCI_DEV_DOWN 4 #define HCI_DEV_DOWN 4
#define HCI_DEV_SUSPEND 5 #define HCI_DEV_SUSPEND 5
#define HCI_DEV_RESUME 6 #define HCI_DEV_RESUME 6
#define HCI_DEV_OPEN 7
#define HCI_DEV_CLOSE 8
/* HCI notify events */ /* HCI notify events */
#define HCI_NOTIFY_CONN_ADD 1 #define HCI_NOTIFY_CONN_ADD 1
......
...@@ -1385,6 +1385,8 @@ static int hci_dev_do_open(struct hci_dev *hdev) ...@@ -1385,6 +1385,8 @@ static int hci_dev_do_open(struct hci_dev *hdev)
goto done; goto done;
} }
hci_notify(hdev, HCI_DEV_OPEN);
atomic_set(&hdev->cmd_cnt, 1); atomic_set(&hdev->cmd_cnt, 1);
set_bit(HCI_INIT, &hdev->flags); set_bit(HCI_INIT, &hdev->flags);
...@@ -1466,6 +1468,8 @@ static int hci_dev_do_open(struct hci_dev *hdev) ...@@ -1466,6 +1468,8 @@ static int hci_dev_do_open(struct hci_dev *hdev)
hdev->sent_cmd = NULL; hdev->sent_cmd = NULL;
} }
hci_notify(hdev, HCI_DEV_CLOSE);
hdev->close(hdev); hdev->close(hdev);
hdev->flags &= BIT(HCI_RAW); hdev->flags &= BIT(HCI_RAW);
} }
...@@ -1649,6 +1653,8 @@ int hci_dev_do_close(struct hci_dev *hdev) ...@@ -1649,6 +1653,8 @@ int hci_dev_do_close(struct hci_dev *hdev)
hdev->sent_cmd = NULL; hdev->sent_cmd = NULL;
} }
hci_notify(hdev, HCI_DEV_CLOSE);
/* After this point our queues are empty /* After this point our queues are empty
* and no tasks are scheduled. */ * and no tasks are scheduled. */
hdev->close(hdev); hdev->close(hdev);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册