On Thu Oct 2 13:32:54 2025 +0300, Sakari Ailus wrote:
> Retain the constness of the object in media_entity_to_video_device() and
> to_video_device(), by switching to container_of_const().
> 
> Signed-off-by: Sakari Ailus <[email protected]>
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 include/media/v4l2-dev.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

---

diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index a213c3398dcf..2e0f6d2e6a78 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -320,8 +320,8 @@ struct video_device {
        typeof(__entity) __me_vdev_ent = __entity;                      \
                                                                        \
        __me_vdev_ent ?                                                 \
-               container_of(__me_vdev_ent,  struct video_device, entity) : \
-               NULL;                                                   \
+               container_of_const(__me_vdev_ent,  struct video_device, \
+                                  entity) : NULL;                      \
 })
 
 /**
@@ -330,7 +330,7 @@ struct video_device {
  *
  * @cd: pointer to &struct device
  */
-#define to_video_device(cd) container_of(cd, struct video_device, dev)
+#define to_video_device(cd) container_of_const(cd, struct video_device, dev)
 
 /**
  * __video_register_device - register video4linux devices
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to