aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorFlorian Grandel <fgrandel@gmail.com>2015-06-17 21:16:38 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-06-18 12:11:51 -0400
commit286e0c83df948eef9f51d50ed68ec8a1bb5051e4 (patch)
tree312e7bf27fee8d7df5986587d18e58b81f915792 /net/bluetooth
parentefae002c2c8acd1fd2d0c6e47122944094c8ae1f (diff)
Bluetooth: mgmt: multi adv for read_adv_features()
The read_adv_features() method had a single instance identifier hard coded. Refer to the advertising instance list instead to return a dynamically generated list of instance identifiers. Signed-off-by: Florian Grandel <fgrandel@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/mgmt.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7fabcb60da2d..49356c7788f9 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -6763,8 +6763,9 @@ static int read_adv_features(struct sock *sk, struct hci_dev *hdev,
6763{ 6763{
6764 struct mgmt_rp_read_adv_features *rp; 6764 struct mgmt_rp_read_adv_features *rp;
6765 size_t rp_len; 6765 size_t rp_len;
6766 int err; 6766 int err, i;
6767 bool instance; 6767 bool instance;
6768 struct adv_info *adv_instance;
6768 u32 supported_flags; 6769 u32 supported_flags;
6769 6770
6770 BT_DBG("%s", hdev->name); 6771 BT_DBG("%s", hdev->name);
@@ -6777,12 +6778,9 @@ static int read_adv_features(struct sock *sk, struct hci_dev *hdev,
6777 6778
6778 rp_len = sizeof(*rp); 6779 rp_len = sizeof(*rp);
6779 6780
6780 /* Currently only one instance is supported, so just add 1 to the
6781 * response length.
6782 */
6783 instance = hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE); 6781 instance = hci_dev_test_flag(hdev, HCI_ADVERTISING_INSTANCE);
6784 if (instance) 6782 if (instance)
6785 rp_len++; 6783 rp_len += hdev->adv_instance_cnt;
6786 6784
6787 rp = kmalloc(rp_len, GFP_ATOMIC); 6785 rp = kmalloc(rp_len, GFP_ATOMIC);
6788 if (!rp) { 6786 if (!rp) {
@@ -6797,12 +6795,16 @@ static int read_adv_features(struct sock *sk, struct hci_dev *hdev,
6797 rp->max_scan_rsp_len = HCI_MAX_AD_LENGTH; 6795 rp->max_scan_rsp_len = HCI_MAX_AD_LENGTH;
6798 rp->max_instances = HCI_MAX_ADV_INSTANCES; 6796 rp->max_instances = HCI_MAX_ADV_INSTANCES;
6799 6797
6800 /* Currently only one instance is supported, so simply return the
6801 * current instance number.
6802 */
6803 if (instance) { 6798 if (instance) {
6804 rp->num_instances = 1; 6799 i = 0;
6805 rp->instance[0] = 1; 6800 list_for_each_entry(adv_instance, &hdev->adv_instances, list) {
6801 if (i >= hdev->adv_instance_cnt)
6802 break;
6803
6804 rp->instance[i] = adv_instance->instance;
6805 i++;
6806 }
6807 rp->num_instances = hdev->adv_instance_cnt;
6806 } else { 6808 } else {
6807 rp->num_instances = 0; 6809 rp->num_instances = 0;
6808 } 6810 }