diff options
author | Dave Airlie | 2017-10-03 04:39:01 +0200 |
---|---|---|
committer | Alex Deucher | 2017-10-06 19:10:08 +0200 |
commit | cb56aceabd36ef42bc7e081c43dc55ef57efba7a (patch) | |
tree | acd03fc81c47b24ef2b2395d07837707c829d375 /drivers/gpu/drm/amd/display/dc/core/dc_sink.c | |
parent | amdgpu/dc: convert dc_stream_state to kref. (diff) | |
download | kernel-qcow2-linux-cb56aceabd36ef42bc7e081c43dc55ef57efba7a.tar.gz kernel-qcow2-linux-cb56aceabd36ef42bc7e081c43dc55ef57efba7a.tar.xz kernel-qcow2-linux-cb56aceabd36ef42bc7e081c43dc55ef57efba7a.zip |
amdgpu/dc: convert dc_sink to kref.
Refcounts use krefs.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/core/dc_sink.c')
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/core/dc_sink.c | 20 |
1 files changed, 10 insertions, 10 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 3d620d3d0672..25fae38409ab 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_sink.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_sink.c @@ -63,19 +63,19 @@ static bool construct(struct dc_sink *sink, const struct dc_sink_init_data *init void dc_sink_retain(struct dc_sink *sink) { - ASSERT(atomic_read(&sink->ref_count) > 0); - atomic_inc(&sink->ref_count); + kref_get(&sink->refcount); } -void dc_sink_release(struct dc_sink *sink) +static void dc_sink_free(struct kref *kref) { - ASSERT(atomic_read(&sink->ref_count) > 0); - atomic_dec(&sink->ref_count); + struct dc_sink *sink = container_of(kref, struct dc_sink, refcount); + destruct(sink); + kfree(sink); +} - if (atomic_read(&sink->ref_count) == 0) { - destruct(sink); - kfree(sink); - } +void dc_sink_release(struct dc_sink *sink) +{ + kref_put(&sink->refcount, dc_sink_free); } struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params) @@ -88,7 +88,7 @@ struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params) if (false == construct(sink, init_params)) goto construct_fail; - atomic_inc(&sink->ref_count); + kref_init(&sink->refcount); return sink; |