mirror of https://github.com/thesofproject/sof.git
buffer: use an accessor to read struct audio_stream::avail
This patch adds audio_stream_get_avail() to read struct audio_stream::avail and converts all users. Apart from hiding internals of the structure, it also enforces the use of the __sparse_cache annotation. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
932cf4f73c
commit
b667c914c6
|
@ -730,7 +730,7 @@ static void rtnr_copy_from_sof_stream(struct audio_stream_rtnr *dst,
|
|||
{
|
||||
|
||||
dst->size = audio_stream_get_size(src);
|
||||
dst->avail = src->avail;
|
||||
dst->avail = audio_stream_get_avail(src);
|
||||
dst->free = src->free;
|
||||
dst->w_ptr = audio_stream_get_wptr(src);
|
||||
dst->r_ptr = audio_stream_get_rptr(src);
|
||||
|
@ -742,7 +742,7 @@ static void rtnr_copy_to_sof_stream(struct audio_stream __sparse_cache *dst,
|
|||
struct audio_stream_rtnr *src)
|
||||
{
|
||||
dst->size = audio_stream_get_size(src);
|
||||
dst->avail = src->avail;
|
||||
dst->avail = audio_stream_get_avail(src);
|
||||
dst->free = src->free;
|
||||
dst->w_ptr = audio_stream_get_wptr(src);
|
||||
dst->r_ptr = audio_stream_get_rptr(src);
|
||||
|
|
|
@ -402,7 +402,7 @@ static int selector_copy(struct comp_dev *dev)
|
|||
|
||||
source_c = buffer_acquire(source);
|
||||
|
||||
if (!source_c->stream.avail) {
|
||||
if (!audio_stream_get_avail(&source_c->stream)) {
|
||||
buffer_release(source_c);
|
||||
return PPL_STATUS_PATH_STOP;
|
||||
}
|
||||
|
|
|
@ -102,6 +102,11 @@ static inline uint32_t audio_stream_get_size(const struct audio_stream __sparse_
|
|||
return buf->size;
|
||||
}
|
||||
|
||||
static inline uint32_t audio_stream_get_avail(const struct audio_stream __sparse_cache *buf)
|
||||
{
|
||||
return buf->avail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves readable address of a sample at specified index (see versions of
|
||||
* this macro specialized for various sample types).
|
||||
|
|
|
@ -837,7 +837,7 @@ static int test_keyword_copy(struct comp_dev *dev)
|
|||
struct comp_buffer, sink_list);
|
||||
source_c = buffer_acquire(source);
|
||||
|
||||
if (!source_c->stream.avail) {
|
||||
if (!audio_stream_get_avail(&source_c->stream)) {
|
||||
buffer_release(source_c);
|
||||
return PPL_STATUS_PATH_STOP;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue