Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/tegra: Switch private_obj initialization to atomic_create_state

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>

+16 -6
+16 -6
drivers/gpu/drm/tegra/hub.c
··· 825 825 kfree(hub_state); 826 826 } 827 827 828 + static struct drm_private_state * 829 + tegra_display_hub_create_state(struct drm_private_obj *obj) 830 + { 831 + struct tegra_display_hub_state *hub_state; 832 + 833 + hub_state = kzalloc_obj(*hub_state); 834 + if (!hub_state) 835 + return ERR_PTR(-ENOMEM); 836 + 837 + __drm_atomic_helper_private_obj_create_state(obj, &hub_state->base); 838 + 839 + return &hub_state->base; 840 + } 841 + 828 842 static const struct drm_private_state_funcs tegra_display_hub_state_funcs = { 843 + .atomic_create_state = tegra_display_hub_create_state, 829 844 .atomic_duplicate_state = tegra_display_hub_duplicate_state, 830 845 .atomic_destroy_state = tegra_display_hub_destroy_state, 831 846 }; ··· 956 941 struct tegra_display_hub *hub = to_tegra_display_hub(client); 957 942 struct drm_device *drm = dev_get_drvdata(client->host); 958 943 struct tegra_drm *tegra = drm->dev_private; 959 - struct tegra_display_hub_state *state; 960 944 961 - state = kzalloc_obj(*state); 962 - if (!state) 963 - return -ENOMEM; 964 - 965 - drm_atomic_private_obj_init(drm, &hub->base, &state->base, 945 + drm_atomic_private_obj_init(drm, &hub->base, NULL, 966 946 &tegra_display_hub_state_funcs); 967 947 968 948 tegra->hub = hub;