Skip to content

Commit

Permalink
sparse: remove __sparse annotations from various places
Browse files Browse the repository at this point in the history
Prev commit removing __sparse was a pure editor action,
this commit is removing some other __sparse annotations and
mappings that must have been done manually

This commit contains "safe" changes only

Signed-off-by: Marcin Szkudlinski <[email protected]>
  • Loading branch information
marcinszkudlinski committed Sep 6, 2023
1 parent ff1dd3f commit 8520a84
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 49 deletions.
63 changes: 16 additions & 47 deletions src/audio/audio_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@

static size_t audio_stream_get_free_size(struct sof_sink *sink)
{
struct audio_stream *audio_stream =
attr_container_of(sink, struct audio_stream,
sink_api, __sparse_cache);
struct audio_stream *audio_stream = container_of(sink, struct audio_stream, sink_api);

return audio_stream_get_free_bytes(audio_stream);
}

static int audio_stream_get_buffer(struct sof_sink *sink, size_t req_size,
void **data_ptr, void **buffer_start, size_t *buffer_size)
{
struct audio_stream *audio_stream =
attr_container_of(sink, struct audio_stream,
sink_api, __sparse_cache);
struct audio_stream *audio_stream = container_of(sink, struct audio_stream, sink_api);

if (req_size > audio_stream_get_free_size(sink))
return -ENODATA;
Expand All @@ -34,15 +30,11 @@ static int audio_stream_get_buffer(struct sof_sink *sink, size_t req_size,

static int audio_stream_commit_buffer(struct sof_sink *sink, size_t commit_size)
{
struct audio_stream *audio_stream =
attr_container_of(sink, struct audio_stream,
sink_api, __sparse_cache);
struct comp_buffer *buffer_c =
attr_container_of(audio_stream, struct comp_buffer,
stream, __sparse_cache);
struct audio_stream *audio_stream = container_of(sink, struct audio_stream, sink_api);
struct comp_buffer *buffer = container_of(audio_stream, struct comp_buffer, stream);

if (commit_size) {
buffer_stream_writeback(buffer_c, commit_size);
buffer_stream_writeback(buffer, commit_size);
audio_stream_produce(audio_stream, commit_size);
}

Expand All @@ -51,28 +43,21 @@ static int audio_stream_commit_buffer(struct sof_sink *sink, size_t commit_size)

static size_t audio_stream_get_data_available(struct sof_source *source)
{
struct audio_stream *audio_stream =
attr_container_of(source, struct audio_stream,
source_api, __sparse_cache);
struct audio_stream *audio_stream = container_of(source, struct audio_stream, source_api);

return audio_stream_get_avail_bytes(audio_stream);
}

static int audio_stream_get_data(struct sof_source *source, size_t req_size,
void **data_ptr, void **buffer_start, size_t *buffer_size)
{
struct audio_stream *audio_stream =
attr_container_of(source, struct audio_stream,
source_api, __sparse_cache);

struct comp_buffer *buffer_c =
attr_container_of(audio_stream, struct comp_buffer,
stream, __sparse_cache);
struct audio_stream *audio_stream = container_of(source, struct audio_stream, source_api);
struct comp_buffer *buffer = container_of(audio_stream, struct comp_buffer, stream);

if (req_size > audio_stream_get_data_available(source))
return -ENODATA;

buffer_stream_invalidate(buffer_c, req_size);
buffer_stream_invalidate(buffer, req_size);

/* get circular buffer parameters */
*data_ptr = audio_stream->r_ptr;
Expand All @@ -83,9 +68,7 @@ static int audio_stream_get_data(struct sof_source *source, size_t req_size,

static int audio_stream_release_data(struct sof_source *source, size_t free_size)
{
struct audio_stream *audio_stream =
attr_container_of(source, struct audio_stream,
source_api, __sparse_cache);
struct audio_stream *audio_stream = container_of(source, struct audio_stream, source_api);

if (free_size)
audio_stream_consume(audio_stream, free_size);
Expand All @@ -97,12 +80,8 @@ static int audio_stream_set_ipc_params_source(struct sof_source *source,
struct sof_ipc_stream_params *params,
bool force_update)
{
struct audio_stream *audio_stream =
attr_container_of(source, struct audio_stream,
source_api, __sparse_cache);
struct comp_buffer *buffer =
attr_container_of(audio_stream, struct comp_buffer,
stream, __sparse_cache);
struct audio_stream *audio_stream = container_of(source, struct audio_stream, source_api);
struct comp_buffer *buffer = container_of(audio_stream, struct comp_buffer, stream);

return buffer_set_params(buffer, params, force_update);
}
Expand All @@ -111,12 +90,8 @@ static int audio_stream_set_ipc_params_sink(struct sof_sink *sink,
struct sof_ipc_stream_params *params,
bool force_update)
{
struct audio_stream *audio_stream =
attr_container_of(sink, struct audio_stream,
sink_api, __sparse_cache);
struct comp_buffer *buffer =
attr_container_of(audio_stream, struct comp_buffer,
stream, __sparse_cache);
struct audio_stream *audio_stream = container_of(sink, struct audio_stream, sink_api);
struct comp_buffer *buffer = container_of(audio_stream, struct comp_buffer, stream);

return buffer_set_params(buffer, params, force_update);
}
Expand All @@ -125,9 +100,7 @@ static int audio_stream_source_set_alignment_constants(struct sof_source *source
const uint32_t byte_align,
const uint32_t frame_align_req)
{
struct audio_stream *audio_stream =
attr_container_of(source, struct audio_stream,
source_api, __sparse_cache);
struct audio_stream *audio_stream = container_of(source, struct audio_stream, source_api);

audio_stream_init_alignment_constants(byte_align, frame_align_req, audio_stream);

Expand All @@ -138,9 +111,7 @@ static int audio_stream_sink_set_alignment_constants(struct sof_sink *sink,
const uint32_t byte_align,
const uint32_t frame_align_req)
{
struct audio_stream *audio_stream =
attr_container_of(sink, struct audio_stream,
sink_api, __sparse_cache);
struct audio_stream *audio_stream = container_of(sink, struct audio_stream, sink_api);

audio_stream_init_alignment_constants(byte_align, frame_align_req, audio_stream);

Expand Down Expand Up @@ -177,10 +148,8 @@ void audio_stream_init(struct audio_stream *audio_stream,
audio_stream_init_alignment_constants(1, 1, audio_stream);

source_init(audio_stream_get_source(audio_stream), &audio_stream_source_ops,
(__sparse_force struct sof_audio_stream_params *)
&audio_stream->runtime_stream_params);
sink_init(audio_stream_get_sink(audio_stream), &audio_stream_sink_ops,
(__sparse_force struct sof_audio_stream_params *)
&audio_stream->runtime_stream_params);
audio_stream_reset(audio_stream);
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ enum module_processing_mode {
* \brief Input stream buffer
*/
struct input_stream_buffer {
void __sparse_cache *data; /* data stream buffer */
void *data; /* data stream buffer */
uint32_t size; /* size of data in the buffer */
uint32_t consumed; /* number of bytes consumed by the module */

Expand All @@ -63,7 +63,7 @@ struct input_stream_buffer {
* \brief Output stream buffer
*/
struct output_stream_buffer {
void __sparse_cache *data; /* data stream buffer */
void *data; /* data stream buffer */
uint32_t size; /* size of data in the buffer */
};

Expand Down

0 comments on commit 8520a84

Please sign in to comment.