Laurent Pinchart 85af84852f media: v4l2-subdev: Provide const-aware subdev state accessors
It would be useful to mark instances of v4l2_subdev_state structures as
const when code needs to access them read-only. This isn't currently
possible, as the v4l2_subdev_state_get_*() accessor functions take a
non-const pointer to the state.

Use _Generic() to provide two different versions of the accessors, for
const and non-const states respectively. The former returns a const
pointer to the requested format, rectangle or interval, implementing
const-correctness. The latter returns a non-const pointer, preserving
the current behaviour for drivers.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
[Sakari Ailus: Drop the word "below" from the text.]
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
2024-06-04 08:31:25 +02:00
..
2023-04-15 08:53:31 +01:00
2023-07-14 13:18:56 +02:00
2024-05-04 10:19:59 +02:00
2021-10-04 07:52:13 +02:00
2024-03-15 11:36:54 -07:00
2023-06-09 16:13:01 +01:00
2021-11-22 07:47:13 +00:00