Skip to content

Commit 59be6ed

Browse files
committed
bluetooth: fast_pair: allow the callback registration in SYS_INIT
Relaxed the context assumptions in the bt_fast_pair_info_cb_register API to allow calling this API during the system initialization. Ref: NCSDK-30487 Signed-off-by: Kamil Piszczek <[email protected]>
1 parent 1133ff3 commit 59be6ed

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

include/bluetooth/services/fast_pair/fast_pair.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ int bt_fast_pair_battery_set(enum bt_fast_pair_battery_comp battery_comp,
302302
* This function can only be called before enabling Fast Pair with the @ref bt_fast_pair_enable
303303
* API.
304304
*
305-
* This function must be called in the cooperative thread context.
305+
* This function must be called in the cooperative thread context or in the system initialization
306+
* context (@ref SYS_INIT macro).
306307
*
307308
* @param cb Callback struct.
308309
*

subsys/bluetooth/services/fast_pair/fp_gatt_service.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,8 +851,9 @@ static void fp_info_cb_account_key_written_notify(struct bt_conn *conn)
851851

852852
int bt_fast_pair_info_cb_register(struct bt_fast_pair_info_cb *cb)
853853
{
854-
/* It is assumed that this function executes in the cooperative thread context. */
855-
__ASSERT_NO_MSG(!k_is_preempt_thread());
854+
/* It is assumed that this function executes in the cooperative thread context
855+
* or in the system initialization context (SYS_INIT macro).
856+
*/
856857
__ASSERT_NO_MSG(!k_is_in_isr());
857858

858859
if (bt_fast_pair_is_ready()) {

0 commit comments

Comments
 (0)