[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240917-scoped-state-v1-2-b8ba3fbe5952@ideasonboard.com>
Date: Tue, 17 Sep 2024 17:09:30 +0300
From: Tomi Valkeinen <tomi.valkeinen@...asonboard.com>
To: Mauro Carvalho Chehab <mchehab@...nel.org>,
Niklas Söderlund <niklas.soderlund@...natech.se>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Sakari Ailus <sakari.ailus@...ux.intel.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-renesas-soc@...r.kernel.org,
Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>
Subject: [PATCH 2/4] media: v4l2-subdev: Use state cleanup macros
From: Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>
Use the new subdev state cleanup macros.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@...asonboard.com>
---
drivers/media/v4l2-core/v4l2-subdev.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index 7c5812d55315..1e701c340d0b 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -1478,10 +1478,9 @@ bool v4l2_subdev_has_pad_interdep(struct media_entity *entity,
{
struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity);
struct v4l2_subdev_krouting *routing;
- struct v4l2_subdev_state *state;
unsigned int i;
- state = v4l2_subdev_lock_and_get_active_state(sd);
+ CLASS(v4l2_subdev_lock_and_get_active_state, state)(sd);
routing = &state->routing;
@@ -1492,14 +1491,10 @@ bool v4l2_subdev_has_pad_interdep(struct media_entity *entity,
continue;
if ((route->sink_pad == pad0 && route->source_pad == pad1) ||
- (route->source_pad == pad0 && route->sink_pad == pad1)) {
- v4l2_subdev_unlock_state(state);
+ (route->source_pad == pad0 && route->sink_pad == pad1))
return true;
- }
}
- v4l2_subdev_unlock_state(state);
-
return false;
}
EXPORT_SYMBOL_GPL(v4l2_subdev_has_pad_interdep);
@@ -2393,7 +2388,6 @@ EXPORT_SYMBOL_GPL(v4l2_subdev_disable_streams);
int v4l2_subdev_s_stream_helper(struct v4l2_subdev *sd, int enable)
{
- struct v4l2_subdev_state *state;
struct v4l2_subdev_route *route;
struct media_pad *pad;
u64 source_mask = 0;
@@ -2419,12 +2413,10 @@ int v4l2_subdev_s_stream_helper(struct v4l2_subdev *sd, int enable)
* As there's a single source pad, just collect all the source
* streams.
*/
- state = v4l2_subdev_lock_and_get_active_state(sd);
+ CLASS(v4l2_subdev_lock_and_get_active_state, state)(sd);
for_each_active_route(&state->routing, route)
source_mask |= BIT_ULL(route->source_stream);
-
- v4l2_subdev_unlock_state(state);
} else {
/*
* For non-streams subdevices, there's a single implicit stream
--
2.43.0
Powered by blists - more mailing lists