Skip to contentSkip to conversation

Bluetooth: Introduce driver specific post init callback

PATCH Applied Marcel Holtmann 2 participants 2 messages Oct 20, 2015 – Oct 21, 2015

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 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.

---
 include/net/bluetooth/hci_core.h | 1 +
 net/bluetooth/hci_core.c         | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)
include/net/bluetooth/hci_core.h +1 -0
index 989c72aabc45..44fb95685611 100644
@@ -398,6 +398,7 @@ struct hci_dev {
 	int (*send)(struct hci_dev *hdev, struct sk_buff *skb);
 	void (*notify)(struct hci_dev *hdev, unsigned int evt);
 	void (*hw_error)(struct hci_dev *hdev, u8 code);
+	int (*post_init)(struct hci_dev *hdev);
 	int (*set_diag)(struct hci_dev *hdev, bool enable);
 	int (*set_bdaddr)(struct hci_dev *hdev, const bdaddr_t *bdaddr);
 };
net/bluetooth/hci_core.c +4 -1
index ac5cb251f9fb..964fba4c96bf 100644
@@ -1503,8 +1503,11 @@ static int hci_dev_do_open(struct hci_dev *hdev)
 
 	if (!ret) {
 		if (!hci_dev_test_flag(hdev, HCI_UNCONFIGURED) &&
-		    !hci_dev_test_flag(hdev, HCI_USER_CHANNEL))
+		    !hci_dev_test_flag(hdev, HCI_USER_CHANNEL)) {
 			ret = __hci_init(hdev);
+			if (!ret && hdev->post_init)
+				ret = hdev->post_init(hdev);
+		}
 	}
 
 	/* If the HCI Reset command is clearing all diagnostic settings,
Signature · 1 line
2.4.3
#1 lore raw

Hi Marcel,

Quoted 10 lines · Marcel Holtmann

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.

---
 include/net/bluetooth/hci_core.h | 1 +
 net/bluetooth/hci_core.c         | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Applied to bluetooth-next. Thanks.

Johan