Skip to content

Commit a61ff1f

Browse files
lyakhlgirdwood
authored andcommitted
buffer: use a mutex for locking under Zephyr
Buffers are never handled from atomic context. Use the _thread variant of the coherent API for them to use a mutex under Zephyr. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent a3d9b02 commit a61ff1f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/audio/buffer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct comp_buffer *buffer_alloc(uint32_t size, uint32_t caps, uint32_t align)
5454
}
5555

5656
buffer_init(buffer, size, caps);
57-
coherent_init(buffer, c);
57+
coherent_init_thread(buffer, c);
5858
list_init(&buffer->source_list);
5959
list_init(&buffer->sink_list);
6060

@@ -167,7 +167,7 @@ void buffer_free(struct comp_buffer *buffer)
167167
/* In case some listeners didn't unregister from buffer's callbacks */
168168
notifier_unregister_all(NULL, buffer);
169169

170-
coherent_free(buffer, c);
170+
coherent_free_thread(buffer, c);
171171
rfree(buffer->stream.addr);
172172
rfree(buffer);
173173
}

src/include/sof/audio/buffer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ static inline void buffer_stream_writeback(struct comp_buffer *buffer, uint32_t
205205

206206
__must_check static inline struct comp_buffer *buffer_acquire(struct comp_buffer *buffer)
207207
{
208-
struct coherent *c = coherent_acquire(&buffer->c, sizeof(*buffer));
208+
struct coherent *c = coherent_acquire_thread(&buffer->c, sizeof(*buffer));
209209

210210
return container_of(c, struct comp_buffer, c);
211211
}
212212

213213
static inline struct comp_buffer *buffer_release(struct comp_buffer *buffer)
214214
{
215-
struct coherent *c = coherent_release(&buffer->c, sizeof(*buffer));
215+
struct coherent *c = coherent_release_thread(&buffer->c, sizeof(*buffer));
216216

217217
return container_of(c, struct comp_buffer, c);
218218
}

0 commit comments

Comments
 (0)