goto val_ctx_fail;
}
- dc->current_context->ref_count++;
+ atomic_inc(&dc->current_context->ref_count);
dc_ctx->cgs_device = init_params->cgs_device;
dc_ctx->driver_context = init_params->driver;
if (context == NULL)
goto context_alloc_fail;
- ++context->ref_count;
+ atomic_inc(&context->ref_count);
if (!is_validation_required(core_dc, set, set_count)) {
dc_resource_validate_ctx_copy_construct(core_dc->current_context, context);
if (context == NULL)
goto context_alloc_fail;
- ++context->ref_count;
+ atomic_inc(&context->ref_count);
result = core_dc->res_pool->funcs->validate_with_context(
core_dc, set, set_count, context, NULL);
if (context == NULL)
goto context_alloc_fail;
- ++context->ref_count;
+ atomic_inc(&context->ref_count);
result = core_dc->res_pool->funcs->validate_guaranteed(
core_dc, stream, context);
if (context == NULL)
goto context_alloc_fail;
- ++context->ref_count;
+ atomic_inc(&context->ref_count);
result = core_dc->res_pool->funcs->validate_with_context(
core_dc, set, stream_count, context, core_dc->current_context);
void dc_retain_validate_context(struct validate_context *context)
{
- ASSERT(context->ref_count > 0);
- ++context->ref_count;
+ ASSERT(atomic_read(&context->ref_count) > 0);
+ atomic_inc(&context->ref_count);
}
void dc_release_validate_context(struct validate_context *context)
{
- ASSERT(context->ref_count > 0);
- --context->ref_count;
+ ASSERT(atomic_read(&context->ref_count) > 0);
+ atomic_dec(&context->ref_count);
- if (context->ref_count == 0) {
+ if (atomic_read(&context->ref_count) == 0) {
dc_resource_validate_ctx_destruct(context);
dm_free(context);
}
if (context == NULL)
goto context_alloc_fail;
- ++context->ref_count;
+ atomic_inc(&context->ref_count);
dc_resource_validate_ctx_copy_construct(
core_dc->current_context, context);
enum dc_acpi_cm_power_state power_state)
{
struct core_dc *core_dc = DC_TO_CORE(dc);
- int ref_count;
+ atomic_t ref_count;
switch (power_state) {
case DC_ACPI_CM_POWER_STATE_D0:
struct validate_context *dst_ctx)
{
int i, j;
- int ref_count = dst_ctx->ref_count;
+ atomic_t ref_count = dst_ctx->ref_count;
*dst_ctx = *src_ctx;
void dc_sink_retain(struct dc_sink *sink)
{
- ASSERT(sink->ref_count > 0);
- ++sink->ref_count;
+ ASSERT(atomic_read(&sink->ref_count) > 0);
+ atomic_inc(&sink->ref_count);
}
void dc_sink_release(struct dc_sink *sink)
{
- ASSERT(sink->ref_count > 0);
- --sink->ref_count;
+ ASSERT(atomic_read(&sink->ref_count) > 0);
+ atomic_dec(&sink->ref_count);
- if (sink->ref_count == 0) {
+ if (atomic_read(&sink->ref_count) == 0) {
destruct(sink);
dm_free(sink);
}
if (false == construct(sink, init_params))
goto construct_fail;
- ++sink->ref_count;
+ atomic_inc(&sink->ref_count);
return sink;
void dc_stream_retain(struct dc_stream_state *stream)
{
-
- ASSERT(stream->ref_count > 0);
- stream->ref_count++;
+ ASSERT(atomic_read(&stream->ref_count) > 0);
+ atomic_inc(&stream->ref_count);
}
void dc_stream_release(struct dc_stream_state *stream)
{
-
if (stream != NULL) {
- ASSERT(stream->ref_count > 0);
- stream->ref_count--;
+ ASSERT(atomic_read(&stream->ref_count) > 0);
+ atomic_dec(&stream->ref_count);
- if (stream->ref_count == 0) {
+ if (atomic_read(&stream->ref_count) == 0) {
destruct(stream);
dm_free(stream);
}
if (false == construct(stream, sink))
goto construct_fail;
- stream->ref_count++;
+ atomic_inc(&stream->ref_count);
return stream;
if (false == construct(core_dc->ctx, plane_state))
goto construct_fail;
- ++plane_state->ref_count;
+ atomic_inc(&plane_state->ref_count);
return plane_state;
void dc_plane_state_retain(struct dc_plane_state *plane_state)
{
- ASSERT(plane_state->ref_count > 0);
- ++plane_state->ref_count;
+ ASSERT(atomic_read(&plane_state->ref_count) > 0);
+ atomic_inc(&plane_state->ref_count);
}
void dc_plane_state_release(struct dc_plane_state *plane_state)
{
- ASSERT(plane_state->ref_count > 0);
- --plane_state->ref_count;
+ ASSERT(atomic_read(&plane_state->ref_count) > 0);
+ atomic_dec(&plane_state->ref_count);
- if (plane_state->ref_count == 0) {
+ if (atomic_read(&plane_state->ref_count) == 0) {
destruct(plane_state);
dm_free(plane_state);
}
void dc_gamma_retain(struct dc_gamma *gamma)
{
- ASSERT(gamma->ref_count > 0);
- ++gamma->ref_count;
+ ASSERT(atomic_read(&gamma->ref_count) > 0);
+ atomic_inc(&gamma->ref_count);
}
void dc_gamma_release(struct dc_gamma **gamma)
{
- ASSERT((*gamma)->ref_count > 0);
- --(*gamma)->ref_count;
+ ASSERT(atomic_read(&(*gamma)->ref_count) > 0);
+ atomic_dec(&(*gamma)->ref_count);
- if ((*gamma)->ref_count == 0)
+ if (atomic_read(&(*gamma)->ref_count) == 0)
dm_free((*gamma));
*gamma = NULL;
if (gamma == NULL)
goto alloc_fail;
- ++gamma->ref_count;
+ atomic_inc(&gamma->ref_count);
return gamma;
void dc_transfer_func_retain(struct dc_transfer_func *tf)
{
- ASSERT(tf->ref_count > 0);
- ++tf->ref_count;
+ ASSERT(atomic_read(&tf->ref_count) > 0);
+ atomic_inc(&tf->ref_count);
}
void dc_transfer_func_release(struct dc_transfer_func *tf)
{
- ASSERT(tf->ref_count > 0);
- --tf->ref_count;
+ ASSERT(atomic_read(&tf->ref_count) > 0);
+ atomic_dec(&tf->ref_count);
- if (tf->ref_count == 0)
+ if (atomic_read(&tf->ref_count) == 0)
dm_free(tf);
}
if (tf == NULL)
goto alloc_fail;
- ++tf->ref_count;
+ atomic_inc(&tf->ref_count);
return tf;
enum dc_transfer_func_type type;
enum dc_transfer_func_predefined tf;
struct dc_context *ctx;
- int ref_count;
+ atomic_t ref_count;
};
/*
/* private to dc_surface.c */
enum dc_irq_source irq_source;
- int ref_count;
+ atomic_t ref_count;
};
struct dc_plane_info {
struct dc_stream_status status;
/* from stream struct */
- int ref_count;
+ atomic_t ref_count;
};
struct dc_stream_update {
struct dc_context *ctx;
/* private to dc_sink.c */
- int ref_count;
+ atomic_t ref_count;
};
void dc_sink_retain(struct dc_sink *sink);
struct dc_context *ctx;
/* private to dc_surface.c */
- int ref_count;
+ atomic_t ref_count;
};
/* Used by both ipp amd opp functions*/
struct dcn_bw_internal_vars dcn_bw_vars;
#endif
- int ref_count;
+ atomic_t ref_count;
};
#endif /* _CORE_TYPES_H_ */