[PATCH 65/70] drm/tegra: Convert to atomic_create_state
Maxime Ripard <[email protected]>
| Newsgroups | org.kernel.vger.linux-tegra,org.freedesktop.lists.dri-devel |
|---|---|
| Message-ID | <[email protected]> |
The tegra crtc implementation provides a custom reset hook. However, this hook only allocates the state, initializes it with __drm_atomic_helper_crtc_reset(), and frees the previous state. It does not perform any hardware reset. Since this is exactly what the atomic_create_state hook is meant to do, minus the old state cleanup which the caller handles, convert the implementation to use atomic_create_state with __drm_atomic_helper_crtc_state_init() instead. Signed-off-by: Maxime Ripard <[email protected]> --- Cc: Jonathan Hunter <[email protected]> Cc: Mikko Perttunen <[email protected]> Cc: Thierry Reding <[email protected]> Cc: [email protected] --- drivers/gpu/drm/tegra/dc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 0b3fcc7011b3..6acf49f69903 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c @@ -1484,21 +1484,21 @@ static struct drm_plane *tegra_dc_add_planes(struct drm_device *drm, static void tegra_dc_destroy(struct drm_crtc *crtc) { drm_crtc_cleanup(crtc); } -static void tegra_crtc_reset(struct drm_crtc *crtc) +static struct drm_crtc_state *tegra_crtc_create_state(struct drm_crtc *crtc) { - struct tegra_dc_state *state = kzalloc_obj(*state); + struct tegra_dc_state *state; - if (crtc->state) - tegra_crtc_atomic_destroy_state(crtc, crtc->state); + state = kzalloc_obj(*state); + if (!state) + return ERR_PTR(-ENOMEM); - if (state) - __drm_atomic_helper_crtc_reset(crtc, &state->base); - else - __drm_atomic_helper_crtc_reset(crtc, NULL); + __drm_atomic_helper_crtc_state_init(&state->base, crtc); + + return &state->base; } static struct drm_crtc_state * tegra_crtc_atomic_duplicate_state(struct drm_crtc *crtc) { @@ -1903,11 +1903,11 @@ static void tegra_dc_disable_vblank(struct drm_crtc *crtc) static const struct drm_crtc_funcs tegra_crtc_funcs = { .page_flip = drm_atomic_helper_page_flip, .set_config = drm_atomic_helper_set_config, .destroy = tegra_dc_destroy, - .reset = tegra_crtc_reset, + .atomic_create_state = tegra_crtc_create_state, .atomic_duplicate_state = tegra_crtc_atomic_duplicate_state, .atomic_destroy_state = tegra_crtc_atomic_destroy_state, .late_register = tegra_dc_late_register, .early_unregister = tegra_dc_early_unregister, .get_vblank_counter = tegra_dc_get_vblank_counter, -- 2.55.0