Commit 89899039 authored by Harry Wentland's avatar Harry Wentland Committed by Alex Deucher

drm/amd/display: Roll sink struct into core_sink

Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d0778ebf
......@@ -27,31 +27,19 @@
#include "dm_helpers.h"
#include "core_types.h"
/*******************************************************************************
* Private definitions
******************************************************************************/
struct sink {
struct core_sink protected;
int ref_count;
};
#define DC_SINK_TO_SINK(dc_sink) \
container_of(dc_sink, struct sink, protected.public)
/*******************************************************************************
* Private functions
******************************************************************************/
static void destruct(struct sink *sink)
static void destruct(struct core_sink *sink)
{
if (sink->protected.public.dc_container_id) {
dm_free(sink->protected.public.dc_container_id);
sink->protected.public.dc_container_id = NULL;
if (sink->public.dc_container_id) {
dm_free(sink->public.dc_container_id);
sink->public.dc_container_id = NULL;
}
}
static bool construct(struct sink *sink, const struct dc_sink_init_data *init_params)
static bool construct(struct core_sink *sink, const struct dc_sink_init_data *init_params)
{
struct dc_link *link = init_params->link;
......@@ -59,13 +47,12 @@ static bool construct(struct sink *sink, const struct dc_sink_init_data *init_pa
if (!link)
return false;
sink->protected.public.sink_signal = init_params->sink_signal;
sink->protected.link = link;
sink->protected.ctx = link->ctx;
sink->protected.public.dongle_max_pix_clk = init_params->dongle_max_pix_clk;
sink->protected.public.converter_disable_audio =
init_params->converter_disable_audio;
sink->protected.public.dc_container_id = NULL;
sink->public.sink_signal = init_params->sink_signal;
sink->link = link;
sink->ctx = link->ctx;
sink->public.dongle_max_pix_clk = init_params->dongle_max_pix_clk;
sink->public.converter_disable_audio = init_params->converter_disable_audio;
sink->public.dc_container_id = NULL;
return true;
}
......@@ -76,7 +63,7 @@ static bool construct(struct sink *sink, const struct dc_sink_init_data *init_pa
void dc_sink_retain(const struct dc_sink *dc_sink)
{
struct sink *sink = DC_SINK_TO_SINK(dc_sink);
struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
ASSERT(sink->ref_count > 0);
++sink->ref_count;
......@@ -84,7 +71,7 @@ void dc_sink_retain(const struct dc_sink *dc_sink)
void dc_sink_release(const struct dc_sink *dc_sink)
{
struct sink *sink = DC_SINK_TO_SINK(dc_sink);
struct core_sink *sink = DC_SINK_TO_CORE(dc_sink);
ASSERT(sink->ref_count > 0);
--sink->ref_count;
......@@ -97,7 +84,7 @@ void dc_sink_release(const struct dc_sink *dc_sink)
struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
{
struct sink *sink = dm_alloc(sizeof(*sink));
struct core_sink *sink = dm_alloc(sizeof(*sink));
if (NULL == sink)
goto alloc_fail;
......@@ -107,7 +94,7 @@ struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params)
++sink->ref_count;
return &sink->protected.public;
return &sink->public;
construct_fail:
dm_free(sink);
......
......@@ -94,6 +94,9 @@ struct core_sink {
/* not used for now */
struct dc_link *link;
struct dc_context *ctx;
/* private to dc_sink.c */
int ref_count;
};
/************ link *****************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment