[PATCH 62/70] drm/rockchip: vop2: Convert to atomic_create_state
Maxime Ripard <[email protected]>
| Newsgroups | org.infradead.lists.linux-rockchip,org.freedesktop.lists.dri-devel |
|---|---|
| Message-ID | <[email protected]> |
The rockchip vop2 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: "Heiko Stübner" <[email protected]> Cc: Andy Yan <[email protected]> Cc: Sandy Huang <[email protected]> Cc: [email protected] --- drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c index 4cce3e336f5b..b2f3a579bbe5 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c @@ -2298,28 +2298,28 @@ static void vop2_crtc_destroy_state(struct drm_crtc *crtc, __drm_atomic_helper_crtc_destroy_state(&vcstate->base); kfree(vcstate); } -static void vop2_crtc_reset(struct drm_crtc *crtc) +static struct drm_crtc_state *vop2_crtc_create_state(struct drm_crtc *crtc) { - struct rockchip_crtc_state *vcstate = kzalloc_obj(*vcstate); + struct rockchip_crtc_state *vcstate; - if (crtc->state) - vop2_crtc_destroy_state(crtc, crtc->state); + vcstate = kzalloc_obj(*vcstate); + if (!vcstate) + return ERR_PTR(-ENOMEM); - if (vcstate) - __drm_atomic_helper_crtc_reset(crtc, &vcstate->base); - else - __drm_atomic_helper_crtc_reset(crtc, NULL); + __drm_atomic_helper_crtc_state_init(&vcstate->base, crtc); + + return &vcstate->base; } static const struct drm_crtc_funcs vop2_crtc_funcs = { .set_config = drm_atomic_helper_set_config, .page_flip = drm_atomic_helper_page_flip, .destroy = drm_crtc_cleanup, - .reset = vop2_crtc_reset, + .atomic_create_state = vop2_crtc_create_state, .atomic_duplicate_state = vop2_crtc_duplicate_state, .atomic_destroy_state = vop2_crtc_destroy_state, .enable_vblank = vop2_crtc_enable_vblank, .disable_vblank = vop2_crtc_disable_vblank, .late_register = vop2_crtc_late_register, -- 2.55.0 _______________________________________________ Linux-rockchip mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-rockchip