summaryrefslogtreecommitdiff
path: root/drivers/media/mc
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2022-08-31 17:13:39 +0300
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-09-24 10:22:30 +0300
commit9e3576a1ae2bb67c4d09d5e6c002fb793c300b58 (patch)
treed97b41cc7372614fa0f3dc97395d4662466ff309 /drivers/media/mc
parent5b4f9a727532ff9732ffc1bceb2017260b81a0ff (diff)
downloadlinux-9e3576a1ae2bb67c4d09d5e6c002fb793c300b58.tar.xz
media: mc: convert pipeline funcs to take media_pad
Now that the pipeline is stored into pads instead of entities, we can change the relevant functions to take pads instead of entities. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'drivers/media/mc')
-rw-r--r--drivers/media/mc/mc-entity.c40
1 files changed, 16 insertions, 24 deletions
diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
index 831076b36847..b8bcbc734eaf 100644
--- a/drivers/media/mc/mc-entity.c
+++ b/drivers/media/mc/mc-entity.c
@@ -700,10 +700,10 @@ done:
return ret;
}
-__must_check int __media_pipeline_start(struct media_entity *entity,
+__must_check int __media_pipeline_start(struct media_pad *pad,
struct media_pipeline *pipe)
{
- struct media_device *mdev = entity->graph_obj.mdev;
+ struct media_device *mdev = pad->entity->graph_obj.mdev;
struct media_pipeline_pad *err_ppad;
struct media_pipeline_pad *ppad;
int ret;
@@ -711,18 +711,10 @@ __must_check int __media_pipeline_start(struct media_entity *entity,
lockdep_assert_held(&mdev->graph_mutex);
/*
- * media_pipeline_start(entity) only makes sense with entities that have
- * a single pad.
- */
-
- if (WARN_ON(entity->num_pads != 1))
- return -EINVAL;
-
- /*
* If the entity is already part of a pipeline, that pipeline must
* be the same as the pipe given to media_pipeline_start().
*/
- if (WARN_ON(entity->pads->pipe && entity->pads->pipe != pipe))
+ if (WARN_ON(pad->pipe && pad->pipe != pipe))
return -EINVAL;
/*
@@ -739,7 +731,7 @@ __must_check int __media_pipeline_start(struct media_entity *entity,
* with media_pipeline_pad instances for each pad found during graph
* walk.
*/
- ret = media_pipeline_populate(pipe, entity->pads);
+ ret = media_pipeline_populate(pipe, pad);
if (ret)
return ret;
@@ -856,22 +848,22 @@ error:
}
EXPORT_SYMBOL_GPL(__media_pipeline_start);
-__must_check int media_pipeline_start(struct media_entity *entity,
+__must_check int media_pipeline_start(struct media_pad *pad,
struct media_pipeline *pipe)
{
- struct media_device *mdev = entity->graph_obj.mdev;
+ struct media_device *mdev = pad->entity->graph_obj.mdev;
int ret;
mutex_lock(&mdev->graph_mutex);
- ret = __media_pipeline_start(entity, pipe);
+ ret = __media_pipeline_start(pad, pipe);
mutex_unlock(&mdev->graph_mutex);
return ret;
}
EXPORT_SYMBOL_GPL(media_pipeline_start);
-void __media_pipeline_stop(struct media_entity *entity)
+void __media_pipeline_stop(struct media_pad *pad)
{
- struct media_pipeline *pipe = entity->pads->pipe;
+ struct media_pipeline *pipe = pad->pipe;
struct media_pipeline_pad *ppad;
/*
@@ -894,19 +886,19 @@ void __media_pipeline_stop(struct media_entity *entity)
}
EXPORT_SYMBOL_GPL(__media_pipeline_stop);
-void media_pipeline_stop(struct media_entity *entity)
+void media_pipeline_stop(struct media_pad *pad)
{
- struct media_device *mdev = entity->graph_obj.mdev;
+ struct media_device *mdev = pad->entity->graph_obj.mdev;
mutex_lock(&mdev->graph_mutex);
- __media_pipeline_stop(entity);
+ __media_pipeline_stop(pad);
mutex_unlock(&mdev->graph_mutex);
}
EXPORT_SYMBOL_GPL(media_pipeline_stop);
-__must_check int media_pipeline_alloc_start(struct media_entity *entity)
+__must_check int media_pipeline_alloc_start(struct media_pad *pad)
{
- struct media_device *mdev = entity->graph_obj.mdev;
+ struct media_device *mdev = pad->entity->graph_obj.mdev;
struct media_pipeline *new_pipe = NULL;
struct media_pipeline *pipe;
int ret;
@@ -917,7 +909,7 @@ __must_check int media_pipeline_alloc_start(struct media_entity *entity)
* Is the entity already part of a pipeline? If not, we need to allocate
* a pipe.
*/
- pipe = media_entity_pipeline(entity);
+ pipe = media_pad_pipeline(pad);
if (!pipe) {
new_pipe = kzalloc(sizeof(*new_pipe), GFP_KERNEL);
if (!new_pipe) {
@@ -929,7 +921,7 @@ __must_check int media_pipeline_alloc_start(struct media_entity *entity)
pipe->allocated = true;
}
- ret = __media_pipeline_start(entity, pipe);
+ ret = __media_pipeline_start(pad, pipe);
if (ret)
kfree(new_pipe);