]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/tegra: Switch private_obj initialization to atomic_create_state
authorMaxime Ripard <mripard@kernel.org>
Tue, 24 Feb 2026 16:10:28 +0000 (17:10 +0100)
committerMaxime Ripard <mripard@kernel.org>
Fri, 20 Mar 2026 09:03:10 +0000 (10:03 +0100)
The tegra 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-3-5a72f8ec9934@kernel.org
Signed-off-by: Maxime Ripard <mripard@kernel.org>
drivers/gpu/drm/tegra/hub.c

index a6fa196c28132ea9839c48639fb3214b32396d02..73190a4b4d0546be6d6cae746ba5d03ab8e98b92 100644 (file)
@@ -825,7 +825,22 @@ static void tegra_display_hub_destroy_state(struct drm_private_obj *obj,
        kfree(hub_state);
 }
 
+static struct drm_private_state *
+tegra_display_hub_create_state(struct drm_private_obj *obj)
+{
+       struct tegra_display_hub_state *hub_state;
+
+       hub_state = kzalloc_obj(*hub_state);
+       if (!hub_state)
+               return ERR_PTR(-ENOMEM);
+
+       __drm_atomic_helper_private_obj_create_state(obj, &hub_state->base);
+
+       return &hub_state->base;
+}
+
 static const struct drm_private_state_funcs tegra_display_hub_state_funcs = {
+       .atomic_create_state = tegra_display_hub_create_state,
        .atomic_duplicate_state = tegra_display_hub_duplicate_state,
        .atomic_destroy_state = tegra_display_hub_destroy_state,
 };
@@ -941,13 +956,8 @@ static int tegra_display_hub_init(struct host1x_client *client)
        struct tegra_display_hub *hub = to_tegra_display_hub(client);
        struct drm_device *drm = dev_get_drvdata(client->host);
        struct tegra_drm *tegra = drm->dev_private;
-       struct tegra_display_hub_state *state;
-
-       state = kzalloc_obj(*state);
-       if (!state)
-               return -ENOMEM;
 
-       drm_atomic_private_obj_init(drm, &hub->base, &state->base,
+       drm_atomic_private_obj_init(drm, &hub->base, NULL,
                                    &tegra_display_hub_state_funcs);
 
        tegra->hub = hub;