dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <mripard@kernel.org>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	 Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>,
	 Simona Vetter <simona@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org,
	Maxime Ripard <mripard@kernel.org>,
	 Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Subject: [PATCH v2 13/16] drm/omapdrm: Switch private_obj initialization to atomic_create_state
Date: Tue, 14 Oct 2025 11:31:57 +0200	[thread overview]
Message-ID: <20251014-drm-private-obj-reset-v2-13-6dd60e985e9d@kernel.org> (raw)
In-Reply-To: <20251014-drm-private-obj-reset-v2-0-6dd60e985e9d@kernel.org>

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.

Signed-off-by: Maxime Ripard <mripard@kernel.org>
---

Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/omap_drv.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 794267f0f007850e43949f93be5c98d0e32a84ea..7a2d7aa5438a519c876033801da5cd5c411bd5fa 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -272,25 +272,35 @@ static void omap_global_destroy_state(struct drm_private_obj *obj,
 	struct omap_global_state *omap_state = to_omap_global_state(state);
 
 	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(sizeof(*state), GFP_KERNEL);
+	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,
 };
 
 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(sizeof(*state), GFP_KERNEL);
-	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;
 }
 
 static void omap_global_obj_fini(struct omap_drm_private *priv)

-- 
2.51.0


  parent reply	other threads:[~2025-10-14 12:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14  9:31 [PATCH v2 00/16] drm/atomic: Allocate drm_private_state through a callback Maxime Ripard
2025-10-14  9:31 ` [PATCH v2 01/16] drm/atomic: Add dev pointer to drm_private_obj Maxime Ripard
2025-10-21  8:16   ` Luca Ceresoli
2025-12-08 15:37   ` (subset) " Maxime Ripard
2025-10-14  9:31 ` [PATCH v2 02/16] drm/atomic: Make drm_atomic_private_obj_init fallible Maxime Ripard
2025-10-14  9:31 ` [PATCH v2 03/16] drm/atomic: Add new atomic_create_state callback to drm_private_obj Maxime Ripard
2025-10-14 22:49   ` Dmitry Baryshkov
2025-10-15  0:17     ` Dmitry Baryshkov
2025-10-21  8:17       ` Luca Ceresoli
2025-12-08 15:48     ` Maxime Ripard
2025-10-14  9:31 ` [PATCH v2 04/16] drm/atomic-helper: Add private_obj atomic_create_state helper Maxime Ripard
2025-10-15  0:16   ` Dmitry Baryshkov
2025-10-14  9:31 ` [PATCH v2 05/16] drm/bridge: Switch private_obj initialization to atomic_create_state Maxime Ripard
2025-10-21  8:17   ` Luca Ceresoli
2025-12-08 15:43     ` Maxime Ripard
2025-10-14  9:31 ` [PATCH v2 06/16] drm/dp_mst: " Maxime Ripard
2025-10-14  9:31 ` [PATCH v2 07/16] drm/dp_tunnel: " Maxime Ripard
2025-10-14  9:31 ` [PATCH v2 08/16] drm/amdgpu: " Maxime Ripard
2025-10-14  9:31 ` [PATCH v2 09/16] drm/arm: komeda: " Maxime Ripard
2025-10-14  9:31 ` [PATCH v2 10/16] drm/ingenic: " Maxime Ripard
2025-10-14  9:31 ` [PATCH v2 11/16] drm/msm: mdp5: " Maxime Ripard
2025-10-15  0:52   ` Dmitry Baryshkov
2025-10-14  9:31 ` [PATCH v2 12/16] drm/msm: dpu1: " Maxime Ripard
2025-10-15  0:52   ` Dmitry Baryshkov
2025-10-14  9:31 ` Maxime Ripard [this message]
2025-10-14  9:31 ` [PATCH v2 14/16] drm/tegra: " Maxime Ripard
2025-10-14  9:31 ` [PATCH v2 15/16] drm/vc4: " Maxime Ripard
2025-10-14  9:32 ` [PATCH v2 16/16] drm/atomic: Remove state argument to drm_atomic_private_obj_init Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251014-drm-private-obj-reset-v2-13-6dd60e985e9d@kernel.org \
    --to=mripard@kernel.org \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=simona@ffwll.ch \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox