From 9d8881816ee60993e41628f916a3a518a3a49420 Mon Sep 17 00:00:00 2001 From: Pieter De Gendt Date: Fri, 5 Jul 2024 10:46:45 +0200 Subject: [PATCH] zbus: Use section iterator for observations Iterating the observations can be simplified to a struct iterator instead of first getting the count and looping afterwards. Signed-off-by: Pieter De Gendt --- subsys/zbus/zbus.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/subsys/zbus/zbus.c b/subsys/zbus/zbus.c index ec0f40dda94c9c..174d6ad47d1400 100644 --- a/subsys/zbus/zbus.c +++ b/subsys/zbus/zbus.c @@ -230,15 +230,7 @@ static inline void chan_update_hop(const struct zbus_channel *chan) static inline void update_all_channels_hop(const struct zbus_observer *obs) { - struct zbus_channel_observation *observation; - - int count; - - STRUCT_SECTION_COUNT(zbus_channel_observation, &count); - - for (int16_t i = 0; i < count; ++i) { - STRUCT_SECTION_GET(zbus_channel_observation, i, &observation); - + STRUCT_SECTION_FOREACH(zbus_channel_observation, observation) { if (obs != observation->obs) { continue; }