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 <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2024-07-05 10:46:45 +02:00 committed by Alberto Escolar
parent 058bfc8065
commit 9d8881816e
1 changed files with 1 additions and 9 deletions

View File

@ -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) static inline void update_all_channels_hop(const struct zbus_observer *obs)
{ {
struct zbus_channel_observation *observation; STRUCT_SECTION_FOREACH(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);
if (obs != observation->obs) { if (obs != observation->obs) {
continue; continue;
} }