Commit b0b5511b authored by Daniel Vetter's avatar Daniel Vetter Committed by Dave Airlie

drm/atomic-helpers: Don't duplicate code in destroy helpers

Random drive-by refactoring I spotted.
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@intel.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 1649c33b
...@@ -2510,12 +2510,9 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_dpms); ...@@ -2510,12 +2510,9 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_dpms);
*/ */
void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc) void drm_atomic_helper_crtc_reset(struct drm_crtc *crtc)
{ {
if (crtc->state) { if (crtc->state)
drm_property_unreference_blob(crtc->state->mode_blob); __drm_atomic_helper_crtc_destroy_state(crtc, crtc->state);
drm_property_unreference_blob(crtc->state->degamma_lut);
drm_property_unreference_blob(crtc->state->ctm);
drm_property_unreference_blob(crtc->state->gamma_lut);
}
kfree(crtc->state); kfree(crtc->state);
crtc->state = kzalloc(sizeof(*crtc->state), GFP_KERNEL); crtc->state = kzalloc(sizeof(*crtc->state), GFP_KERNEL);
...@@ -2621,8 +2618,8 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state); ...@@ -2621,8 +2618,8 @@ EXPORT_SYMBOL(drm_atomic_helper_crtc_destroy_state);
*/ */
void drm_atomic_helper_plane_reset(struct drm_plane *plane) void drm_atomic_helper_plane_reset(struct drm_plane *plane)
{ {
if (plane->state && plane->state->fb) if (plane->state)
drm_framebuffer_unreference(plane->state->fb); __drm_atomic_helper_plane_destroy_state(plane, plane->state);
kfree(plane->state); kfree(plane->state);
plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL); plane->state = kzalloc(sizeof(*plane->state), GFP_KERNEL);
...@@ -2743,6 +2740,10 @@ void drm_atomic_helper_connector_reset(struct drm_connector *connector) ...@@ -2743,6 +2740,10 @@ void drm_atomic_helper_connector_reset(struct drm_connector *connector)
struct drm_connector_state *conn_state = struct drm_connector_state *conn_state =
kzalloc(sizeof(*conn_state), GFP_KERNEL); kzalloc(sizeof(*conn_state), GFP_KERNEL);
if (connector->state)
__drm_atomic_helper_connector_destroy_state(connector,
connector->state);
kfree(connector->state); kfree(connector->state);
__drm_atomic_helper_connector_reset(connector, conn_state); __drm_atomic_helper_connector_reset(connector, conn_state);
} }
......
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