Bluetooth: mgmt: multi adv for remove_advertising*()
commit01948331af001cd893c8733a4288e9ad246f62f3
authorFlorian Grandel <fgrandel@gmail.com>
Thu, 18 Jun 2015 01:16:48 +0000 (18 03:16 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 18 Jun 2015 16:11:52 +0000 (18 18:11 +0200)
tree33ee0686cd75b9aa5b74da40cb810636b3714f30
parentfffd38bca51c9a1c00508b754ab66edb6f39cf37
Bluetooth: mgmt: multi adv for remove_advertising*()

The remove_advertising() and remove_advertising_complete() functions
had instance identifiers hard coded. Notably, when passing in 0x00 as
an instance identifier to signal that all instances should be removed
then the mgmt API would return a hard coded 0x01 rather than returning
the expected value 0x00. This bug is being fixed by always referencing
the instance identifier from the management API call instead.

remove_advertising() is refactored to use the new dynamic advertising
instance list. The logic is being changed to make multi-instance
advertising actually work, notably the schedule_adv_instance() method is
being referenced to make sure that other instances will continue to
advertise even if one instance is being removed.

The code is made more readable by factoring advertising instance
management and initialization into the low-level
hci_remove_adv_instance() and hci_adv_instances_clear() functions.

The method now references the clear_adv_instance() helper method to
remove duplicate logic and code.

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