]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
Bluetooth: mgmt: multi adv for create_instance_scan_rsp_data()
authorFlorian Grandel <fgrandel@gmail.com>
Thu, 18 Jun 2015 01:16:43 +0000 (03:16 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 18 Jun 2015 16:11:52 +0000 (18:11 +0200)
The create_instance_scan_rsp_data() function could not deal with
multiple advertising instances previously. This is being fixed by adding
an additional instance parameter.

Signed-off-by: Florian Grandel <fgrandel@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c

index 76aee8a3acf0263276f43f3f770eaaead9bcd310..fc807dcc253370de589a75038ecfa2307b873207 100644 (file)
@@ -872,15 +872,22 @@ static u8 create_default_scan_rsp_data(struct hci_dev *hdev, u8 *ptr)
        return ad_len;
 }
 
-static u8 create_instance_scan_rsp_data(struct hci_dev *hdev, u8 *ptr)
+static u8 create_instance_scan_rsp_data(struct hci_dev *hdev, u8 instance,
+                                       u8 *ptr)
 {
+       struct adv_info *adv_instance;
+
+       adv_instance = hci_find_adv_instance(hdev, instance);
+       if (!adv_instance)
+               return 0;
+
        /* TODO: Set the appropriate entries based on advertising instance flags
         * here once flags other than 0 are supported.
         */
-       memcpy(ptr, hdev->adv_instance.scan_rsp_data,
-              hdev->adv_instance.scan_rsp_len);
+       memcpy(ptr, adv_instance->scan_rsp_data,
+              adv_instance->scan_rsp_len);
 
-       return hdev->adv_instance.scan_rsp_len;
+       return adv_instance->scan_rsp_len;
 }
 
 static void update_inst_scan_rsp_data(struct hci_request *req, u8 instance)
@@ -895,7 +902,7 @@ static void update_inst_scan_rsp_data(struct hci_request *req, u8 instance)
        memset(&cp, 0, sizeof(cp));
 
        if (instance)
-               len = create_instance_scan_rsp_data(hdev, cp.data);
+               len = create_instance_scan_rsp_data(hdev, instance, cp.data);
        else
                len = create_default_scan_rsp_data(hdev, cp.data);