mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 16:12:59 +02:00
drm/omapdrm: Switch private_obj initialization to atomic_create_state
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>
This commit is contained in:
parent
3c668e8c65
commit
af95bb0092
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user