This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: v4l: subdev: Store the sub-device in the sub-device state
Author:  Sakari Ailus <sakari.ai...@linux.intel.com>
Date:    Fri Oct 13 09:15:48 2023 +0200

Store the sub-device in the sub-device state. This will be needed in e.g.
validating pad number when retrieving information for non-stream-aware
users. There are expected to be more needs for this in the future.

Signed-off-by: Sakari Ailus <sakari.ai...@linux.intel.com>
Reviewed-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkei...@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mche...@kernel.org>

 drivers/media/v4l2-core/v4l2-subdev.c | 2 ++
 include/media/v4l2-subdev.h           | 2 ++
 2 files changed, 4 insertions(+)

---

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c 
b/drivers/media/v4l2-core/v4l2-subdev.c
index be86b906c985..cd3ff5b19d0c 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -1448,6 +1448,8 @@ __v4l2_subdev_state_alloc(struct v4l2_subdev *sd, const 
char *lock_name,
        else
                state->lock = &state->_lock;
 
+       state->sd = sd;
+
        /* Drivers that support streams do not need the legacy pad config */
        if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS) && sd->entity.num_pads) {
                state->pads = kvcalloc(sd->entity.num_pads,
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 8a345b5fa39d..46296852cb5b 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -749,6 +749,7 @@ struct v4l2_subdev_krouting {
  *
  * @_lock: default for 'lock'
  * @lock: mutex for the state. May be replaced by the user.
+ * @sd: the sub-device which the state is related to
  * @pads: &struct v4l2_subdev_pad_config array
  * @routing: routing table for the subdev
  * @stream_configs: stream configurations (only for V4L2_SUBDEV_FL_STREAMS)
@@ -761,6 +762,7 @@ struct v4l2_subdev_state {
        /* lock for the struct v4l2_subdev_state fields */
        struct mutex _lock;
        struct mutex *lock;
+       struct v4l2_subdev *sd;
        struct v4l2_subdev_pad_config *pads;
        struct v4l2_subdev_krouting routing;
        struct v4l2_subdev_stream_configs stream_configs;

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to