Skip to content

Commit

Permalink
fix to tools
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinszkudlinski committed Feb 12, 2025
1 parent 0e7bb6d commit b96a987
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions src/include/sof/audio/component.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,7 @@ static inline struct comp_buffer *comp_dev_get_first_data_producer(struct comp_d
/**
* Get a pointer to the next comp_buffer object providing data to the component
* The function will return NULL if there're no more data providers
* _save version also checks if producer != NULL
*/
static inline struct comp_buffer *comp_dev_get_next_data_producer(struct comp_dev *component,
struct comp_buffer *producer)
Expand All @@ -657,6 +658,12 @@ static inline struct comp_buffer *comp_dev_get_next_data_producer(struct comp_de
list_item(producer->sink_list.next, struct comp_buffer, sink_list);
}

static inline struct comp_buffer *comp_dev_get_next_data_producer_safe(struct comp_dev *component,
struct comp_buffer *producer)
{
return producer ? comp_dev_get_next_data_producer(component, producer) : NULL;
}

/**
* Get a pointer to the first comp_buffer object receiving data from the component
* The function will return NULL if there's no data consumers
Expand All @@ -670,6 +677,7 @@ static inline struct comp_buffer *comp_dev_get_first_data_consumer(struct comp_d
/**
* Get a pointer to the next comp_buffer object receiving data from the component
* The function will return NULL if there're no more data consumers
* _safe version also checks if consumer is != NULL
*/
static inline struct comp_buffer *comp_dev_get_next_data_consumer(struct comp_dev *component,
struct comp_buffer *consumer)
Expand All @@ -678,6 +686,12 @@ static inline struct comp_buffer *comp_dev_get_next_data_consumer(struct comp_de
list_item(consumer->source_list.next, struct comp_buffer, source_list);
}

static inline struct comp_buffer *comp_dev_get_next_data_consumer_safe(struct comp_dev *component,
struct comp_buffer *consumer)
{
return consumer ? comp_dev_get_next_data_consumer(component, consumer) : NULL;
}

/*
* a macro for easy iteration through component's list of producers
*/
Expand All @@ -692,12 +706,12 @@ static inline struct comp_buffer *comp_dev_get_next_data_consumer(struct comp_de
*
* additional "safe storage" pointer to struct comp_buffer must be provided
*/
#define comp_dev_for_each_producer_safe(_dev, _producer, _next_producer) \
for (_producer = comp_dev_get_first_data_producer(_dev), \
_next_producer = comp_dev_get_next_data_producer(_dev, _producer); \
_producer != NULL; \
_producer = _next_producer, \
_next_producer = comp_dev_get_next_data_producer(_dev, _producer))
#define comp_dev_for_each_producer_safe(_dev, _producer, _next_producer) \
for (_producer = comp_dev_get_first_data_producer(_dev), \
_next_producer = comp_dev_get_next_data_producer_safe(_dev, _producer); \
_producer != NULL; \
_producer = _next_producer, \
_next_producer = comp_dev_get_next_data_producer_safe(_dev, _producer))

/*
* a macro for easy iteration through component's list of consumers
Expand All @@ -713,12 +727,12 @@ static inline struct comp_buffer *comp_dev_get_next_data_consumer(struct comp_de
*
* additional "safe storage" pointer to struct comp_buffer must be provided
*/
#define comp_dev_for_each_consumer_safe(_dev, _consumer, _next_consumer) \
for (_consumer = comp_dev_get_first_data_consumer(_dev), \
_next_consumer = comp_dev_get_next_data_consumer(_dev, _consumer); \
_consumer != NULL; \
_consumer = _next_consumer, \
_next_consumer = comp_dev_get_next_data_consumer(_dev, _consumer))
#define comp_dev_for_each_consumer_safe(_dev, _consumer, _next_consumer) \
for (_consumer = comp_dev_get_first_data_consumer(_dev), \
_next_consumer = comp_dev_get_next_data_consumer_safe(_dev, _consumer); \
_consumer != NULL; \
_consumer = _next_consumer, \
_next_consumer = comp_dev_get_next_data_consumer_safe(_dev, _consumer))

/** @}*/

Expand Down

0 comments on commit b96a987

Please sign in to comment.