From 2c47cf7a522f8d9478104149ec460dbedd50cdae Mon Sep 17 00:00:00 2001 From: Kamil Piszczek Date: Fri, 6 Dec 2024 16:37:16 +0100 Subject: [PATCH] bluetooth: fast_pair: fmdn: callbacks: migrate to slist find API Updated the FMDN callbacks module that is part of the Google Fast Pair library to use the new slist API for checking if the potential slist node is already included in the target slist instance. Ref: NCSDK-30487 Signed-off-by: Kamil Piszczek --- .../services/fast_pair/fmdn/callbacks.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/subsys/bluetooth/services/fast_pair/fmdn/callbacks.c b/subsys/bluetooth/services/fast_pair/fmdn/callbacks.c index ed83b396355d..ae5dcce9fd46 100644 --- a/subsys/bluetooth/services/fast_pair/fmdn/callbacks.c +++ b/subsys/bluetooth/services/fast_pair/fmdn/callbacks.c @@ -5,6 +5,7 @@ */ #include +#include #include LOG_MODULE_REGISTER(fp_fmdn_callbacks, CONFIG_BT_FAST_PAIR_LOG_LEVEL); @@ -56,19 +57,6 @@ void fp_fmdn_callbacks_provisioning_state_changed_notify(bool provisioned) } } -static bool node_uniqueness_validate(sys_slist_t *slist, sys_snode_t *new_node) -{ - sys_snode_t *current_node; - - SYS_SLIST_FOR_EACH_NODE(slist, current_node) { - if (current_node == new_node) { - return false; - } - } - - return true; -} - static int cb_register(sys_slist_t *slist, struct bt_fast_pair_fmdn_info_cb *cb) { if (bt_fast_pair_is_ready()) { @@ -83,7 +71,7 @@ static int cb_register(sys_slist_t *slist, struct bt_fast_pair_fmdn_info_cb *cb) return -EINVAL; } - if (!node_uniqueness_validate(slist, &cb->node)) { + if (sys_slist_find(slist, &cb->node, NULL)) { return 0; }