diff --git a/include/bluetooth/services/fast_pair/fast_pair.h b/include/bluetooth/services/fast_pair/fast_pair.h index 4b9c16814312..c39a1077bc6a 100644 --- a/include/bluetooth/services/fast_pair/fast_pair.h +++ b/include/bluetooth/services/fast_pair/fast_pair.h @@ -302,7 +302,8 @@ int bt_fast_pair_battery_set(enum bt_fast_pair_battery_comp battery_comp, * This function can only be called before enabling Fast Pair with the @ref bt_fast_pair_enable * API. * - * This function must be called in the cooperative thread context. + * This function must be called in the cooperative thread context or in the system initialization + * context (@ref SYS_INIT macro). * * @param cb Callback struct. * diff --git a/include/bluetooth/services/fast_pair/fmdn.h b/include/bluetooth/services/fast_pair/fmdn.h index 4565a2102f4b..4c912a316bb3 100644 --- a/include/bluetooth/services/fast_pair/fmdn.h +++ b/include/bluetooth/services/fast_pair/fmdn.h @@ -14,9 +14,11 @@ * @defgroup bt_fast_pair_fmdn Fast Pair FMDN API * @brief Fast Pair FMDN API * - * It is required to use the Fast Pair FMDN API in the cooperative thread context - * (for example, system workqueue thread). Following this requirement guarantees - * a proper synchronization between the user operations and the module operations. + * It is required to use the Fast Pair FMDN API in the cooperative thread context. + * API function exceptions that do not follow this rule mention alternative requirements + * explicitly in their API documentation. Following the cooperative thread context + * requirement guarantees proper synchronization between the user operations and the + * module operations. * * @{ */ @@ -234,6 +236,9 @@ struct bt_fast_pair_fmdn_ring_cb { * You can call this function only in the disabled state of the FMDN module * (see @ref bt_fast_pair_is_ready function). * + * This function must be called in the cooperative thread context or in the system initialization + * context (@ref SYS_INIT macro). + * * @param cb Ringing callback structure. * * @return 0 if the operation was successful. Otherwise, a (negative) error code is returned. @@ -355,6 +360,9 @@ struct bt_fast_pair_fmdn_motion_detector_cb { * You can call this function only in the disabled state of the FMDN module * (see @ref bt_fast_pair_is_ready function). * + * This function must be called in the cooperative thread context or in the system initialization + * context (@ref SYS_INIT macro). + * * @param cb Motion detector callback structure. * * @return 0 if the operation was successful. Otherwise, a (negative) error code is returned. @@ -529,6 +537,9 @@ struct bt_fast_pair_fmdn_info_cb { * This API for callback registration is optional and does not have to be used. You can * register multiple instances of information callbacks. * + * This function must be called in the cooperative thread context or in the system initialization + * context (@ref SYS_INIT macro). + * * @param cb Information callback structure. * * @return 0 if the operation was successful. Otherwise, a (negative) error code is returned. @@ -565,6 +576,9 @@ struct bt_fast_pair_fmdn_read_mode_cb { * You can call this function only in the disabled state of the FMDN module * (see @ref bt_fast_pair_is_ready function). * + * This function must be called in the cooperative thread context or in the system initialization + * context (@ref SYS_INIT macro). + * * @param cb Read mode callback structure. * * @return 0 if the operation was successful. Otherwise, a (negative) error code is returned. diff --git a/subsys/bluetooth/services/fast_pair/fp_gatt_service.c b/subsys/bluetooth/services/fast_pair/fp_gatt_service.c index 702cf9ebbdb7..ef97b89a6cfd 100644 --- a/subsys/bluetooth/services/fast_pair/fp_gatt_service.c +++ b/subsys/bluetooth/services/fast_pair/fp_gatt_service.c @@ -851,8 +851,9 @@ static void fp_info_cb_account_key_written_notify(struct bt_conn *conn) int bt_fast_pair_info_cb_register(struct bt_fast_pair_info_cb *cb) { - /* It is assumed that this function executes in the cooperative thread context. */ - __ASSERT_NO_MSG(!k_is_preempt_thread()); + /* It is assumed that this function executes in the cooperative thread context + * or in the system initialization context (SYS_INIT macro). + */ __ASSERT_NO_MSG(!k_is_in_isr()); if (bt_fast_pair_is_ready()) {