All the objects that need to implement some callbacks in KMS have a
pointer in there structure to the main drm_device.

However, it's not the case for drm_private_objs, which makes it harder
than it needs to be to implement some of its callbacks. Let's add that
pointer.

Signed-off-by: Maxime Ripard <[email protected]>
---
 drivers/gpu/drm/drm_atomic.c | 1 +
 include/drm/drm_atomic.h     | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
index 
ed5359a71f7e2cd8fa52b993e62ee65f8fed4537..39cb1479ac4d58cd71cf41d27d0d2a8a58ef5791
 100644
--- a/drivers/gpu/drm/drm_atomic.c
+++ b/drivers/gpu/drm/drm_atomic.c
@@ -790,10 +790,11 @@ drm_atomic_private_obj_init(struct drm_device *dev,
 {
        memset(obj, 0, sizeof(*obj));
 
        drm_modeset_lock_init(&obj->lock);
 
+       obj->dev = dev;
        obj->state = state;
        obj->funcs = funcs;
        list_add_tail(&obj->head, &dev->mode_config.privobj_list);
 
        state->obj = obj;
diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
index 
38636a593c9d98cadda85ccd67326cb152f0dd27..dac70f685361d8d29844acd1b0cc2f04f43a9499
 100644
--- a/include/drm/drm_atomic.h
+++ b/include/drm/drm_atomic.h
@@ -282,10 +282,15 @@ struct drm_private_state_funcs {
  * commit to complete as the first step of
  * &drm_mode_config_helper_funcs.atomic_commit_tail, similar to
  * drm_atomic_helper_wait_for_dependencies().
  */
 struct drm_private_obj {
+       /**
+        * @dev: parent DRM device
+        */
+       struct drm_device *dev;
+
        /**
         * @head: List entry used to attach a private object to a &drm_device
         * (queued to &drm_mode_config.privobj_list).
         */
        struct list_head head;

-- 
2.51.0

Reply via email to