Commit 88b94ce9 authored by Johan Hedberg's avatar Johan Hedberg Committed by Marcel Holtmann

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: default avatarJohan Hedberg <johan.hedberg@intel.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent a380b6cf
...@@ -1305,6 +1305,7 @@ struct hci_mgmt_chan { ...@@ -1305,6 +1305,7 @@ struct hci_mgmt_chan {
unsigned short channel; unsigned short channel;
size_t handler_count; size_t handler_count;
const struct hci_mgmt_handler *handlers; const struct hci_mgmt_handler *handlers;
void (*hdev_init) (struct sock *sk, struct hci_dev *hdev);
}; };
int hci_mgmt_chan_register(struct hci_mgmt_chan *c); int hci_mgmt_chan_register(struct hci_mgmt_chan *c);
......
...@@ -6493,8 +6493,8 @@ int mgmt_control(struct hci_mgmt_chan *chan, struct sock *sk, ...@@ -6493,8 +6493,8 @@ int mgmt_control(struct hci_mgmt_chan *chan, struct sock *sk,
goto done; goto done;
} }
if (hdev) if (hdev && chan->hdev_init)
mgmt_init_hdev(sk, hdev); chan->hdev_init(sk, hdev);
cp = buf + sizeof(*hdr); cp = buf + sizeof(*hdr);
...@@ -7706,6 +7706,7 @@ static struct hci_mgmt_chan chan = { ...@@ -7706,6 +7706,7 @@ static struct hci_mgmt_chan chan = {
.channel = HCI_CHANNEL_CONTROL, .channel = HCI_CHANNEL_CONTROL,
.handler_count = ARRAY_SIZE(mgmt_handlers), .handler_count = ARRAY_SIZE(mgmt_handlers),
.handlers = mgmt_handlers, .handlers = mgmt_handlers,
.hdev_init = mgmt_init_hdev,
}; };
int mgmt_init(void) int mgmt_init(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment