/* Locking: called with entity->graph_obj.mdev->graph_mutex mutex held. */ static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable, struct media_entity_graph *graph) { struct media_entity *entity_err = entity; int ret; /* * Walk current graph and call the pipeline open/close routine for each * opened video node that belongs to the graph of entities connected * through active links. This is needed as we cannot power on/off the * subdevs in random order. */ media_entity_graph_walk_start(graph, entity); while ((entity = media_entity_graph_walk_next(graph))) { if (!is_media_entity_v4l2_io(entity)) continue; ret = __fimc_md_modify_pipeline(entity, enable); if (ret < 0) goto err; } return 0; err: media_entity_graph_walk_start(graph, entity_err); while ((entity_err = media_entity_graph_walk_next(graph))) { if (!is_media_entity_v4l2_io(entity_err)) continue; __fimc_md_modify_pipeline(entity_err, !enable); if (entity_err == entity) break; } return ret; }
/* * iss_pipeline_pm_use_count - Count the number of users of a pipeline * @entity: The entity * * Return the total number of users of all video device nodes in the pipeline. */ static int iss_pipeline_pm_use_count(struct media_entity *entity, struct media_entity_graph *graph) { int use = 0; media_entity_graph_walk_start(graph, entity); while ((entity = media_entity_graph_walk_next(graph))) { if (is_media_entity_v4l2_io(entity)) use += entity->use_count; } return use; }