[PATCH 0/2] media: v4l2-subdev: Support const-awareness in state accessors

Laurent Pinchart laurent.pinchart+renesas at ideasonboard.com
Mon May 6 10:52:53 PDT 2024


Hello,

This small patch series comes from a mild annoyance I experienced during
a recent patch review, where I wanted to ask for a pointer to a
v4l2_subdev_state used to access the state in a read-only fashion to be
made const. This wasn't possible as the state accessors functions take a
non-const state pointer, in order to return pointers to mutable formats
and selection rectangles.

Patch 1/2 improves the state accessors to support const states, in the
same wait as the recently introduced container_of_const() macro.
Bikeshedding of the internal macro and function names is expected. Patch
2/2 then shows how this can be used in one driver.

Laurent Pinchart (2):
  media: v4l2-subdev: Provide const-aware subdev state accessors
  media: rkisp1: Mark subdev state pointers as const

 .../platform/rockchip/rkisp1/rkisp1-isp.c     |  8 +--
 .../platform/rockchip/rkisp1/rkisp1-resizer.c |  8 +--
 drivers/media/v4l2-core/v4l2-subdev.c         | 24 +++----
 include/media/v4l2-subdev.h                   | 66 +++++++++++++------
 4 files changed, 65 insertions(+), 41 deletions(-)


base-commit: e695668af8523b059127dfa8b261c76e7c9cde10
-- 
Regards,

Laurent Pinchart




More information about the Linux-rockchip mailing list