]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Bluetooth: Add hdev_init callback for HCI channels
authorJohan Hedberg <johan.hedberg@intel.com>
Tue, 17 Mar 2015 11:48:49 +0000 (13:48 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 17 Mar 2015 17:03:08 +0000 (18:03 +0100)
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 <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
include/net/bluetooth/hci_core.h
net/bluetooth/mgmt.c

index e4dc18eed446855777eaadf50aaa22b36443da8b..93e7b2b05a17fe4cc5aab615070082bdbe88a279 100644 (file)
@@ -1305,6 +1305,7 @@ struct hci_mgmt_chan {
        unsigned short channel;
        size_t handler_count;
        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);
index 915a2a1f0a7110cae1b0181e3a3377d65ec121de..ac897e676d5e5e94a286d544b1f063e7473205ea 100644 (file)
@@ -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)