Re: [PATCH v7 15/16] drm/vkms: Switch container_of helpers to container_of_const

From: Oarora Etimis

Date: Tue Nov 03 2026 - 12:42:04 EST


Reviewed-by: Oarora Etimis <oaroraetimis@xxxxxxxxx>

On 10/30/26 6:27 PM, Maxime Ripard wrote:
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)
/**