#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;
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;
}
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;
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;
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;
++sink->ref_count;
- return &sink->protected.public;
+ return &sink->public;
construct_fail:
dm_free(sink);