[PATCH v3 10/11] drm/vkms: Switch container_of helpers to container_of_const

From: Maxime Ripard

Date: Tue Sep 08 2026 - 11:36:02 EST


The vkms container_of helpers use container_of() which discards the
const qualifier from the input pointer. This prevents passing a const
state pointer to to_vkms_plane_state() without a cast, for instance
in atomic_get_property which receives a const drm_plane_state.

Switch all four helpers to container_of_const() so the const qualifier
is properly propagated to the result type.

Signed-off-by: Maxime Ripard <mripard@xxxxxxxxxx>
---
drivers/gpu/drm/vkms/vkms_drv.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h
index 381483aa4fb0..dea6cad3f1b9 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.h
+++ b/drivers/gpu/drm/vkms/vkms_drv.h
@@ -248,20 +248,20 @@ struct vkms_device {
/*
* The following helpers are used to convert a member of a struct into its parent.
*/

#define drm_crtc_to_vkms_output(target) \
- container_of(target, struct vkms_output, crtc)
+ container_of_const(target, struct vkms_output, crtc)

#define drm_device_to_vkms_device(target) \
- container_of(target, struct vkms_device, drm)
+ container_of_const(target, struct vkms_device, drm)

#define to_vkms_crtc_state(target)\
- container_of(target, struct vkms_crtc_state, base)
+ container_of_const(target, struct vkms_crtc_state, base)

#define to_vkms_plane_state(target)\
- container_of(target, struct vkms_plane_state, base.base)
+ container_of_const(target, struct vkms_plane_state, base.base)

/**
* vkms_create() - Create a device from a configuration
* @config: Config used to configure the new device
*

--
2.55.0