From 88b94ce925cb103851f39bfa7e23e09823573d30 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 17 Mar 2015 13:48:49 +0200 Subject: Bluetooth: Add hdev_init callback for HCI channels In order to make the mgmt command handling more generic we can't have a direct call to mgmt_init_hdev() from mgmt_control(). This patch adds a new callback to struct hci_mgmt_chan. And sets it to point to the mgmt_init_hdev() function for the HCI_CHANNEL_CONTROL instance. Signed-off-by: Johan Hedberg Signed-off-by: Marcel Holtmann --- net/bluetooth/mgmt.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'net/bluetooth') diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 915a2a1f0a71..ac897e676d5e 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -6493,8 +6493,8 @@ int mgmt_control(struct hci_mgmt_chan *chan, struct sock *sk, goto done; } - if (hdev) - mgmt_init_hdev(sk, hdev); + if (hdev && chan->hdev_init) + chan->hdev_init(sk, hdev); cp = buf + sizeof(*hdr); @@ -7706,6 +7706,7 @@ static struct hci_mgmt_chan chan = { .channel = HCI_CHANNEL_CONTROL, .handler_count = ARRAY_SIZE(mgmt_handlers), .handlers = mgmt_handlers, + .hdev_init = mgmt_init_hdev, }; int mgmt_init(void) -- cgit v1.2.3-59-g8ed1b