From: Maarten Lankhorst Date: Fri, 1 Mar 2019 12:56:24 +0000 (+0100) Subject: drm/tegra: Convert to using __drm_atomic_helper_crtc_reset() for reset. X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=b7e0b04ae450a0f2f73c376c3057fb05d798e33c;p=openwrt%2Fstaging%2Fblogic.git drm/tegra: Convert to using __drm_atomic_helper_crtc_reset() for reset. Convert tegra to using __drm_atomic_helper_crtc_reset(), instead of writing its own version. Instead of open coding destroy_state(), call it directly for freeing the old state. Signed-off-by: Maarten Lankhorst Cc: Thierry Reding Cc: Jonathan Hunter Cc: linux-tegra@vger.kernel.org [mlankhorst: Keep tegra_crtc_reset at the same place and predeclare tegra_crtc_atomic_destroy_state (tagr)] Acked-by: Thierry Reding Link: https://patchwork.freedesktop.org/patch/msgid/20190301125627.7285-15-maarten.lankhorst@linux.intel.com --- diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 607a6ea17ecc..079250c85733 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -26,6 +26,9 @@ #include #include +static void tegra_crtc_atomic_destroy_state(struct drm_crtc *crtc, + struct drm_crtc_state *state); + static void tegra_dc_stats_reset(struct tegra_dc_stats *stats) { stats->frames = 0; @@ -1155,20 +1158,12 @@ static void tegra_dc_destroy(struct drm_crtc *crtc) static void tegra_crtc_reset(struct drm_crtc *crtc) { - struct tegra_dc_state *state; + struct tegra_dc_state *state = kzalloc(sizeof(*state), GFP_KERNEL); if (crtc->state) - __drm_atomic_helper_crtc_destroy_state(crtc->state); - - kfree(crtc->state); - crtc->state = NULL; - - state = kzalloc(sizeof(*state), GFP_KERNEL); - if (state) { - crtc->state = &state->base; - crtc->state->crtc = crtc; - } + tegra_crtc_atomic_destroy_state(crtc, crtc->state); + __drm_atomic_helper_crtc_reset(crtc, &state->base); drm_crtc_vblank_reset(crtc); }