You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2018/11/21 22:47:37 UTC

[mynewt-nimble] 05/06: Combine ble_gap_preempt() and ble_gap_ensure_preempted()

This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 68a7f7815b11634ee2d3f6367a869ccb33f2d893
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Mon Nov 19 10:37:57 2018 -0800

    Combine ble_gap_preempt() and ble_gap_ensure_preempted()
---
 nimble/host/src/ble_gap.c      | 16 ++--------------
 nimble/host/src/ble_gap_priv.h |  1 -
 nimble/host/src/ble_hs_stop.c  |  2 +-
 3 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/nimble/host/src/ble_gap.c b/nimble/host/src/ble_gap.c
index e131a7d..6824f79 100644
--- a/nimble/host/src/ble_gap.c
+++ b/nimble/host/src/ble_gap.c
@@ -4673,6 +4673,8 @@ ble_gap_preempt_no_lock(void)
 }
 
 /**
+ * @brief Preempts the GAP if it is not already preempted.
+ *
  * Aborts all active GAP procedures and prevents new ones from being started.
  * This function is used to ensure an idle GAP so that the controller's
  * resolving list can be modified.  When done accessing the resolving list, the
@@ -4687,20 +4689,6 @@ ble_gap_preempt(void)
 {
     ble_hs_lock();
 
-    BLE_HS_DBG_ASSERT(!ble_gap_is_preempted());
-    ble_gap_preempt_no_lock();
-
-    ble_hs_unlock();
-}
-
-/**
- * Preempts the GAP if it is not already preempted.
- */
-void
-ble_gap_ensure_preempted(void)
-{
-    ble_hs_lock();
-
     if (!ble_gap_is_preempted()) {
         ble_gap_preempt_no_lock();
     }
diff --git a/nimble/host/src/ble_gap_priv.h b/nimble/host/src/ble_gap_priv.h
index 0a566c6..a789f39 100644
--- a/nimble/host/src/ble_gap_priv.h
+++ b/nimble/host/src/ble_gap_priv.h
@@ -110,7 +110,6 @@ int ble_gap_repeat_pairing_event(const struct ble_gap_repeat_pairing *rp);
 int ble_gap_master_in_progress(void);
 
 void ble_gap_preempt(void);
-void ble_gap_ensure_preempted(void);
 void ble_gap_preempt_done(void);
 
 void ble_gap_conn_broken(uint16_t conn_handle, int reason);
diff --git a/nimble/host/src/ble_hs_stop.c b/nimble/host/src/ble_hs_stop.c
index 2c46188..31480d7 100644
--- a/nimble/host/src/ble_hs_stop.c
+++ b/nimble/host/src/ble_hs_stop.c
@@ -193,7 +193,7 @@ ble_hs_stop(struct ble_hs_stop_listener *listener,
     }
 
     /* Abort all active GAP procedures. */
-    ble_gap_ensure_preempted();
+    ble_gap_preempt();
     ble_gap_preempt_done();
 
     rc = ble_gap_event_listener_register(&ble_hs_stop_gap_listener,