[PATCH v6 14/15] drm/vkms: Switch container_of helpers to container_of_const

From: Maxime Ripard

Date: Thu Oct 22 2026 - 10:01:32 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.

Reviewed-by: Daniel Stone <daniels@xxxxxxxxxxxxx>
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
@@ -251,14 +251,14 @@ struct vkms_device {

#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)

/**

--
2.55.0