]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/omapdrm: Switch private_obj initialization to atomic_create_state
authorMaxime Ripard <mripard@kernel.org>
Tue, 24 Feb 2026 16:10:27 +0000 (17:10 +0100)
committerMaxime Ripard <mripard@kernel.org>
Fri, 20 Mar 2026 09:03:10 +0000 (10:03 +0100)
The omapdrm driver relies on a drm_private_obj, that is initialized by
allocating and initializing a state, and then passing it to
drm_private_obj_init.

Since we're gradually moving away from that pattern to the more
established one relying on a atomic_create_state implementation, let's
migrate this instance to the new pattern.

Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://patch.msgid.link/20260224-drm-private-obj-reset-v5-2-5a72f8ec9934@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/omapdrm/omap_drv.c

index bf0bad8c8cf120baa124b439f3fcbfe36c976d12..90832b4b8c9dd540c8778cb39de7cf80e8796857 100644 (file)
@@ -275,7 +275,22 @@ static void omap_global_destroy_state(struct drm_private_obj *obj,
        kfree(omap_state);
 }
 
+static struct drm_private_state *
+omap_global_atomic_create_state(struct drm_private_obj *obj)
+{
+       struct omap_global_state *state;
+
+       state = kzalloc_obj(*state);
+       if (!state)
+               return ERR_PTR(-ENOMEM);
+
+       __drm_atomic_helper_private_obj_create_state(obj, &state->base);
+
+       return &state->base;
+}
+
 static const struct drm_private_state_funcs omap_global_state_funcs = {
+       .atomic_create_state = omap_global_atomic_create_state,
        .atomic_duplicate_state = omap_global_duplicate_state,
        .atomic_destroy_state = omap_global_destroy_state,
 };
@@ -283,13 +298,8 @@ static const struct drm_private_state_funcs omap_global_state_funcs = {
 static int omap_global_obj_init(struct drm_device *dev)
 {
        struct omap_drm_private *priv = dev->dev_private;
-       struct omap_global_state *state;
-
-       state = kzalloc_obj(*state);
-       if (!state)
-               return -ENOMEM;
 
-       drm_atomic_private_obj_init(dev, &priv->glob_obj, &state->base,
+       drm_atomic_private_obj_init(dev, &priv->glob_obj, NULL,
                                    &omap_global_state_funcs);
        return 0;
 }