drm/amd/display: Roll sink struct into core_sink
authorHarry Wentland <harry.wentland@amd.com>
Mon, 24 Jul 2017 17:55:26 +0000 (13:55 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 26 Sep 2017 22:15:36 +0000 (18:15 -0400)
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/core/dc_sink.c
drivers/gpu/drm/amd/display/dc/inc/core_types.h

index 7f0ba72..1f7985a 100644 (file)
 #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);
index 6cdfeeb..eed31a8 100644 (file)
@@ -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 *****************/