Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: v4l2-dev: Make macros to obtain containers const-aware

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 <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Sakari Ailus and committed by
Hans Verkuil
68871116 f17d2896

+3 -3
+3 -3
include/media/v4l2-dev.h
··· 320 320 typeof(__entity) __me_vdev_ent = __entity; \ 321 321 \ 322 322 __me_vdev_ent ? \ 323 - container_of(__me_vdev_ent, struct video_device, entity) : \ 324 - NULL; \ 323 + container_of_const(__me_vdev_ent, struct video_device, \ 324 + entity) : NULL; \ 325 325 }) 326 326 327 327 /** ··· 330 330 * 331 331 * @cd: pointer to &struct device 332 332 */ 333 - #define to_video_device(cd) container_of(cd, struct video_device, dev) 333 + #define to_video_device(cd) container_of_const(cd, struct video_device, dev) 334 334 335 335 /** 336 336 * __video_register_device - register video4linux devices