Skip to content

Commit 98a63aa

Browse files
holtmannjhedberg
authored andcommitted
Bluetooth: Introduce driver specific post init callback
Some drivers might have to restore certain settings after the init procedure has been completed. This driver callback allows them to hook into that stage. This callback is run just before the controller is declared as powered up. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
1 parent aee61f7 commit 98a63aa

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

‎include/net/bluetooth/hci_core.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ struct hci_dev {
398398
int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
399399
void (*notify)(struct hci_dev *hdev, unsigned int evt);
400400
void (*hw_error)(struct hci_dev *hdev, u8 code);
401+
int (*post_init)(struct hci_dev *hdev);
401402
int (*set_diag)(struct hci_dev *hdev, bool enable);
402403
int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
403404
};

‎net/bluetooth/hci_core.c‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1503,8 +1503,11 @@ static int hci_dev_do_open(struct hci_dev *hdev)
15031503

15041504
if (!ret) {
15051505
if (!hci_dev_test_flag(hdev, HCI_UNCONFIGURED) &&
1506-
!hci_dev_test_flag(hdev, HCI_USER_CHANNEL))
1506+
!hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) {
15071507
ret = __hci_init(hdev);
1508+
if (!ret && hdev->post_init)
1509+
ret = hdev->post_init(hdev);
1510+
}
15081511
}
15091512

15101513
/* If the HCI Reset command is clearing all diagnostic settings,

0 commit comments

Comments
 (0)