[PATCH 030/120] drm/amd/display: Roll sink struct into core_sink

Harry Wentland harry.wentland at amd.com
Wed Aug 9 15:01:16 UTC 2017


Change-Id: I83e07a5f8301743afd93b67626e8af1ab6c83d86
Signed-off-by: Harry Wentland <harry.wentland at amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng at amd.com>
Acked-by: Harry Wentland <Harry.Wentland at amd.com>
---
 drivers/gpu/drm/amd/display/dc/core/dc_sink.c   | 43 +++++++++----------------
 drivers/gpu/drm/amd/display/dc/inc/core_types.h |  3 ++
 2 files changed, 18 insertions(+), 28 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_sink.c b/drivers/gpu/drm/amd/display/dc/core/dc_sink.c
index 7f0ba7267682..1f7985ad5dba 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc_sink.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc_sink.c
@@ -28,30 +28,18 @@
 #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);
diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
index 6cdfeeba0faf..eed31a827a90 100644
--- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h
+++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h
@@ -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 *****************/
-- 
2.11.0



More information about the amd-gfx mailing list