Bluetooth: Fix KEEP_ADVERTISING flag treatment in bt_le_adv_stop()
The BT_DEV_ADVERTISING flag already does a suffient job with tracking the actual advertising state, so there's no need for bt_le_adv_stop() to return an error if KEEP_ADVERTISING is set. We still need to clear KEEP_ADVERTISING, but it should not be considered an error if it was not set. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
d98a3ce428
commit
3cb4d295d0
1 changed files with 3 additions and 8 deletions
|
@ -4284,15 +4284,10 @@ int bt_le_adv_stop(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* Advertise disable may fail if slave connections are established,
|
/* Make sure advertising is not re-enabled later even if it's not
|
||||||
* and advertising is not kept ON as the controller does not support
|
* currently enabled (i.e. BT_DEV_ADVERTISING is not set).
|
||||||
* simultaneous slave connections and connectable advertising state.
|
|
||||||
* Hence, we test and clear BT_DEV_KEEP_ADVERTISING flag before trying
|
|
||||||
* to disable advertising if BT_DEV_ADVERTISING is set.
|
|
||||||
*/
|
*/
|
||||||
if (!atomic_test_and_clear_bit(bt_dev.flags, BT_DEV_KEEP_ADVERTISING)) {
|
atomic_clear_bit(bt_dev.flags, BT_DEV_KEEP_ADVERTISING);
|
||||||
return -EALREADY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!atomic_test_bit(bt_dev.flags, BT_DEV_ADVERTISING)) {
|
if (!atomic_test_bit(bt_dev.flags, BT_DEV_ADVERTISING)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue