The ssd130x 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: Javier Martinez Canillas <[email protected]>
---
 drivers/gpu/drm/solomon/ssd130x.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/solomon/ssd130x.c 
b/drivers/gpu/drm/solomon/ssd130x.c
index 0b0fc6fe3df2..ff112d8094c3 100644
--- a/drivers/gpu/drm/solomon/ssd130x.c
+++ b/drivers/gpu/drm/solomon/ssd130x.c
@@ -1465,21 +1465,23 @@ static int ssd133x_crtc_atomic_check(struct drm_crtc 
*crtc,
 
        return 0;
 }
 
 /* Called during init to allocate the CRTC's atomic state. */
-static void ssd130x_crtc_reset(struct drm_crtc *crtc)
+static struct drm_crtc_state *ssd130x_crtc_create_state(struct drm_crtc *crtc)
 {
        struct ssd130x_crtc_state *ssd130x_state;
 
        drm_WARN_ON_ONCE(crtc->dev, crtc->state);
 
        ssd130x_state = kzalloc_obj(*ssd130x_state);
        if (!ssd130x_state)
-               return;
+               return ERR_PTR(-ENOMEM);
 
-       __drm_atomic_helper_crtc_reset(crtc, &ssd130x_state->base);
+       __drm_atomic_helper_crtc_state_init(&ssd130x_state->base, crtc);
+
+       return &ssd130x_state->base;
 }
 
 static struct drm_crtc_state *ssd130x_crtc_duplicate_state(struct drm_crtc 
*crtc)
 {
        struct ssd130x_crtc_state *old_ssd130x_state;
@@ -1532,11 +1534,11 @@ static const struct drm_crtc_helper_funcs 
ssd130x_crtc_helper_funcs[] = {
                .atomic_check = ssd133x_crtc_atomic_check,
        },
 };
 
 static const struct drm_crtc_funcs ssd130x_crtc_funcs = {
-       .reset = ssd130x_crtc_reset,
+       .atomic_create_state = ssd130x_crtc_create_state,
        .destroy = drm_crtc_cleanup,
        .set_config = drm_atomic_helper_set_config,
        .page_flip = drm_atomic_helper_page_flip,
        .atomic_duplicate_state = ssd130x_crtc_duplicate_state,
        .atomic_destroy_state = ssd130x_crtc_destroy_state,

-- 
2.55.0

Reply via email to