Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] media: Rename graph and pipeline structs and functions

The media_entity_pipeline_start() and media_entity_pipeline_stop()
functions are renamed as media_pipeline_start() and media_pipeline_stop(),
respectively. The reason is two-fold: the pipeline struct is, rightly,
already called media_pipeline (rather than media_entity_pipeline) and what
this really is about is a pipeline. A pipeline consists of entities ---
and, well, other objects embedded in these entities.

As the pipeline object will be in the future moved from entities to pads
in order to support multiple pipelines through a single entity, do the
renaming now.

Similarly, functions operating on struct media_entity_graph as well as the
struct itself are renamed by dropping the "entity_" part from the prefix
of the function family and the data structure. The graph traversal which
is what the functions are about is not specifically about entities only
and will operate on pads for the same reason as the media pipeline.

The patch has been generated using the following command:

git grep -l media_entity |xargs perl -i -pe '
s/media_entity_pipeline/media_pipeline/g;
s/media_entity_graph/media_graph/g'

And a few manual edits related to line start alignment and line wrapping.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Sakari Ailus and committed by
Mauro Carvalho Chehab
20b85227 12030f48

+174 -177
+9 -9
Documentation/media/kapi/mc-core.rst
··· 162 162 currently defined as 16. 163 163 164 164 Drivers initiate a graph traversal by calling 165 - :c:func:`media_entity_graph_walk_start()` 165 + :c:func:`media_graph_walk_start()` 166 166 167 167 The graph structure, provided by the caller, is initialized to start graph 168 168 traversal at the given entity. 169 169 170 170 Drivers can then retrieve the next entity by calling 171 - :c:func:`media_entity_graph_walk_next()` 171 + :c:func:`media_graph_walk_next()` 172 172 173 173 When the graph traversal is complete the function will return ``NULL``. 174 174 ··· 206 206 207 207 When starting streaming, drivers must notify all entities in the pipeline to 208 208 prevent link states from being modified during streaming by calling 209 - :c:func:`media_entity_pipeline_start()`. 209 + :c:func:`media_pipeline_start()`. 210 210 211 211 The function will mark all entities connected to the given entity through 212 212 enabled links, either directly or indirectly, as streaming. ··· 218 218 pipeline through the struct :c:type:`media_entity` 219 219 pipe field. 220 220 221 - Calls to :c:func:`media_entity_pipeline_start()` can be nested. 221 + Calls to :c:func:`media_pipeline_start()` can be nested. 222 222 The pipeline pointer must be identical for all nested calls to the function. 223 223 224 - :c:func:`media_entity_pipeline_start()` may return an error. In that case, 224 + :c:func:`media_pipeline_start()` may return an error. In that case, 225 225 it will clean up any of the changes it did by itself. 226 226 227 227 When stopping the stream, drivers must notify the entities with 228 - :c:func:`media_entity_pipeline_stop()`. 228 + :c:func:`media_pipeline_stop()`. 229 229 230 - If multiple calls to :c:func:`media_entity_pipeline_start()` have been 231 - made the same number of :c:func:`media_entity_pipeline_stop()` calls 230 + If multiple calls to :c:func:`media_pipeline_start()` have been 231 + made the same number of :c:func:`media_pipeline_stop()` calls 232 232 are required to stop streaming. 233 233 The :c:type:`media_entity`.\ ``pipe`` field is reset to ``NULL`` on the last 234 234 nested stop call. ··· 245 245 Link validation 246 246 ^^^^^^^^^^^^^^^ 247 247 248 - Link validation is performed by :c:func:`media_entity_pipeline_start()` 248 + Link validation is performed by :c:func:`media_pipeline_start()` 249 249 for any entity which has sink pads in the pipeline. The 250 250 :c:type:`media_entity`.\ ``link_validate()`` callback is used for that 251 251 purpose. In ``link_validate()`` callback, entity driver should check
+4 -4
drivers/media/media-device.c
··· 597 597 598 598 if (mdev->entity_internal_idx_max 599 599 >= mdev->pm_count_walk.ent_enum.idx_max) { 600 - struct media_entity_graph new = { .top = 0 }; 600 + struct media_graph new = { .top = 0 }; 601 601 602 602 /* 603 603 * Initialise the new graph walk before cleaning up 604 604 * the old one in order not to spoil the graph walk 605 605 * object of the media device if graph walk init fails. 606 606 */ 607 - ret = media_entity_graph_walk_init(&new, mdev); 607 + ret = media_graph_walk_init(&new, mdev); 608 608 if (ret) { 609 609 mutex_unlock(&mdev->graph_mutex); 610 610 return ret; 611 611 } 612 - media_entity_graph_walk_cleanup(&mdev->pm_count_walk); 612 + media_graph_walk_cleanup(&mdev->pm_count_walk); 613 613 mdev->pm_count_walk = new; 614 614 } 615 615 mutex_unlock(&mdev->graph_mutex); ··· 691 691 { 692 692 ida_destroy(&mdev->entity_internal_idx); 693 693 mdev->entity_internal_idx_max = 0; 694 - media_entity_graph_walk_cleanup(&mdev->pm_count_walk); 694 + media_graph_walk_cleanup(&mdev->pm_count_walk); 695 695 mutex_destroy(&mdev->graph_mutex); 696 696 } 697 697 EXPORT_SYMBOL_GPL(media_device_cleanup);
+38 -39
drivers/media/media-entity.c
··· 254 254 } 255 255 256 256 /* push an entity to traversal stack */ 257 - static void stack_push(struct media_entity_graph *graph, 257 + static void stack_push(struct media_graph *graph, 258 258 struct media_entity *entity) 259 259 { 260 260 if (graph->top == MEDIA_ENTITY_ENUM_MAX_DEPTH - 1) { ··· 266 266 graph->stack[graph->top].entity = entity; 267 267 } 268 268 269 - static struct media_entity *stack_pop(struct media_entity_graph *graph) 269 + static struct media_entity *stack_pop(struct media_graph *graph) 270 270 { 271 271 struct media_entity *entity; 272 272 ··· 285 285 #define MEDIA_ENTITY_MAX_PADS 512 286 286 287 287 /** 288 - * media_entity_graph_walk_init - Allocate resources for graph walk 288 + * media_graph_walk_init - Allocate resources for graph walk 289 289 * @graph: Media graph structure that will be used to walk the graph 290 290 * @mdev: Media device 291 291 * 292 292 * Reserve resources for graph walk in media device's current 293 293 * state. The memory must be released using 294 - * media_entity_graph_walk_free(). 294 + * media_graph_walk_free(). 295 295 * 296 296 * Returns error on failure, zero on success. 297 297 */ 298 - __must_check int media_entity_graph_walk_init( 299 - struct media_entity_graph *graph, struct media_device *mdev) 298 + __must_check int media_graph_walk_init( 299 + struct media_graph *graph, struct media_device *mdev) 300 300 { 301 301 return media_entity_enum_init(&graph->ent_enum, mdev); 302 302 } 303 - EXPORT_SYMBOL_GPL(media_entity_graph_walk_init); 303 + EXPORT_SYMBOL_GPL(media_graph_walk_init); 304 304 305 305 /** 306 - * media_entity_graph_walk_cleanup - Release resources related to graph walking 306 + * media_graph_walk_cleanup - Release resources related to graph walking 307 307 * @graph: Media graph structure that was used to walk the graph 308 308 */ 309 - void media_entity_graph_walk_cleanup(struct media_entity_graph *graph) 309 + void media_graph_walk_cleanup(struct media_graph *graph) 310 310 { 311 311 media_entity_enum_cleanup(&graph->ent_enum); 312 312 } 313 - EXPORT_SYMBOL_GPL(media_entity_graph_walk_cleanup); 313 + EXPORT_SYMBOL_GPL(media_graph_walk_cleanup); 314 314 315 - void media_entity_graph_walk_start(struct media_entity_graph *graph, 316 - struct media_entity *entity) 315 + void media_graph_walk_start(struct media_graph *graph, 316 + struct media_entity *entity) 317 317 { 318 318 media_entity_enum_zero(&graph->ent_enum); 319 319 media_entity_enum_set(&graph->ent_enum, entity); ··· 322 322 graph->stack[graph->top].entity = NULL; 323 323 stack_push(graph, entity); 324 324 } 325 - EXPORT_SYMBOL_GPL(media_entity_graph_walk_start); 325 + EXPORT_SYMBOL_GPL(media_graph_walk_start); 326 326 327 - struct media_entity * 328 - media_entity_graph_walk_next(struct media_entity_graph *graph) 327 + struct media_entity *media_graph_walk_next(struct media_graph *graph) 329 328 { 330 329 if (stack_top(graph) == NULL) 331 330 return NULL; ··· 363 364 364 365 return stack_pop(graph); 365 366 } 366 - EXPORT_SYMBOL_GPL(media_entity_graph_walk_next); 367 + EXPORT_SYMBOL_GPL(media_graph_walk_next); 367 368 368 369 /* ----------------------------------------------------------------------------- 369 370 * Pipeline management 370 371 */ 371 372 372 - __must_check int __media_entity_pipeline_start(struct media_entity *entity, 373 - struct media_pipeline *pipe) 373 + __must_check int __media_pipeline_start(struct media_entity *entity, 374 + struct media_pipeline *pipe) 374 375 { 375 376 struct media_device *mdev = entity->graph_obj.mdev; 376 - struct media_entity_graph *graph = &pipe->graph; 377 + struct media_graph *graph = &pipe->graph; 377 378 struct media_entity *entity_err = entity; 378 379 struct media_link *link; 379 380 int ret; 380 381 381 382 if (!pipe->streaming_count++) { 382 - ret = media_entity_graph_walk_init(&pipe->graph, mdev); 383 + ret = media_graph_walk_init(&pipe->graph, mdev); 383 384 if (ret) 384 385 goto error_graph_walk_start; 385 386 } 386 387 387 - media_entity_graph_walk_start(&pipe->graph, entity); 388 + media_graph_walk_start(&pipe->graph, entity); 388 389 389 - while ((entity = media_entity_graph_walk_next(graph))) { 390 + while ((entity = media_graph_walk_next(graph))) { 390 391 DECLARE_BITMAP(active, MEDIA_ENTITY_MAX_PADS); 391 392 DECLARE_BITMAP(has_no_links, MEDIA_ENTITY_MAX_PADS); 392 393 ··· 465 466 * Link validation on graph failed. We revert what we did and 466 467 * return the error. 467 468 */ 468 - media_entity_graph_walk_start(graph, entity_err); 469 + media_graph_walk_start(graph, entity_err); 469 470 470 - while ((entity_err = media_entity_graph_walk_next(graph))) { 471 + while ((entity_err = media_graph_walk_next(graph))) { 471 472 /* Sanity check for negative stream_count */ 472 473 if (!WARN_ON_ONCE(entity_err->stream_count <= 0)) { 473 474 entity_err->stream_count--; ··· 485 486 486 487 error_graph_walk_start: 487 488 if (!--pipe->streaming_count) 488 - media_entity_graph_walk_cleanup(graph); 489 + media_graph_walk_cleanup(graph); 489 490 490 491 return ret; 491 492 } 492 - EXPORT_SYMBOL_GPL(__media_entity_pipeline_start); 493 + EXPORT_SYMBOL_GPL(__media_pipeline_start); 493 494 494 - __must_check int media_entity_pipeline_start(struct media_entity *entity, 495 - struct media_pipeline *pipe) 495 + __must_check int media_pipeline_start(struct media_entity *entity, 496 + struct media_pipeline *pipe) 496 497 { 497 498 struct media_device *mdev = entity->graph_obj.mdev; 498 499 int ret; 499 500 500 501 mutex_lock(&mdev->graph_mutex); 501 - ret = __media_entity_pipeline_start(entity, pipe); 502 + ret = __media_pipeline_start(entity, pipe); 502 503 mutex_unlock(&mdev->graph_mutex); 503 504 return ret; 504 505 } 505 - EXPORT_SYMBOL_GPL(media_entity_pipeline_start); 506 + EXPORT_SYMBOL_GPL(media_pipeline_start); 506 507 507 - void __media_entity_pipeline_stop(struct media_entity *entity) 508 + void __media_pipeline_stop(struct media_entity *entity) 508 509 { 509 - struct media_entity_graph *graph = &entity->pipe->graph; 510 + struct media_graph *graph = &entity->pipe->graph; 510 511 struct media_pipeline *pipe = entity->pipe; 511 512 512 513 513 514 WARN_ON(!pipe->streaming_count); 514 - media_entity_graph_walk_start(graph, entity); 515 + media_graph_walk_start(graph, entity); 515 516 516 - while ((entity = media_entity_graph_walk_next(graph))) { 517 + while ((entity = media_graph_walk_next(graph))) { 517 518 /* Sanity check for negative stream_count */ 518 519 if (!WARN_ON_ONCE(entity->stream_count <= 0)) { 519 520 entity->stream_count--; ··· 523 524 } 524 525 525 526 if (!--pipe->streaming_count) 526 - media_entity_graph_walk_cleanup(graph); 527 + media_graph_walk_cleanup(graph); 527 528 528 529 } 529 - EXPORT_SYMBOL_GPL(__media_entity_pipeline_stop); 530 + EXPORT_SYMBOL_GPL(__media_pipeline_stop); 530 531 531 - void media_entity_pipeline_stop(struct media_entity *entity) 532 + void media_pipeline_stop(struct media_entity *entity) 532 533 { 533 534 struct media_device *mdev = entity->graph_obj.mdev; 534 535 535 536 mutex_lock(&mdev->graph_mutex); 536 - __media_entity_pipeline_stop(entity); 537 + __media_pipeline_stop(entity); 537 538 mutex_unlock(&mdev->graph_mutex); 538 539 } 539 - EXPORT_SYMBOL_GPL(media_entity_pipeline_stop); 540 + EXPORT_SYMBOL_GPL(media_pipeline_stop); 540 541 541 542 /* ----------------------------------------------------------------------------- 542 543 * Module use count
+4 -4
drivers/media/platform/exynos4-is/fimc-capture.c
··· 536 536 mutex_lock(&fimc->lock); 537 537 538 538 if (close && vc->streaming) { 539 - media_entity_pipeline_stop(&vc->ve.vdev.entity); 539 + media_pipeline_stop(&vc->ve.vdev.entity); 540 540 vc->streaming = false; 541 541 } 542 542 ··· 1195 1195 if (fimc_capture_active(fimc)) 1196 1196 return -EBUSY; 1197 1197 1198 - ret = media_entity_pipeline_start(entity, &vc->ve.pipe->mp); 1198 + ret = media_pipeline_start(entity, &vc->ve.pipe->mp); 1199 1199 if (ret < 0) 1200 1200 return ret; 1201 1201 ··· 1229 1229 } 1230 1230 1231 1231 err_p_stop: 1232 - media_entity_pipeline_stop(entity); 1232 + media_pipeline_stop(entity); 1233 1233 return ret; 1234 1234 } 1235 1235 ··· 1244 1244 if (ret < 0) 1245 1245 return ret; 1246 1246 1247 - media_entity_pipeline_stop(&vc->ve.vdev.entity); 1247 + media_pipeline_stop(&vc->ve.vdev.entity); 1248 1248 vc->streaming = false; 1249 1249 return 0; 1250 1250 }
+4 -4
drivers/media/platform/exynos4-is/fimc-isp-video.c
··· 312 312 mutex_lock(&isp->video_lock); 313 313 314 314 if (v4l2_fh_is_singular_file(file) && ivc->streaming) { 315 - media_entity_pipeline_stop(entity); 315 + media_pipeline_stop(entity); 316 316 ivc->streaming = 0; 317 317 } 318 318 ··· 489 489 struct media_entity *me = &ve->vdev.entity; 490 490 int ret; 491 491 492 - ret = media_entity_pipeline_start(me, &ve->pipe->mp); 492 + ret = media_pipeline_start(me, &ve->pipe->mp); 493 493 if (ret < 0) 494 494 return ret; 495 495 ··· 504 504 isp->video_capture.streaming = 1; 505 505 return 0; 506 506 p_stop: 507 - media_entity_pipeline_stop(me); 507 + media_pipeline_stop(me); 508 508 return ret; 509 509 } 510 510 ··· 519 519 if (ret < 0) 520 520 return ret; 521 521 522 - media_entity_pipeline_stop(&video->ve.vdev.entity); 522 + media_pipeline_stop(&video->ve.vdev.entity); 523 523 video->streaming = 0; 524 524 return 0; 525 525 }
+4 -4
drivers/media/platform/exynos4-is/fimc-lite.c
··· 524 524 if (v4l2_fh_is_singular_file(file) && 525 525 atomic_read(&fimc->out_path) == FIMC_IO_DMA) { 526 526 if (fimc->streaming) { 527 - media_entity_pipeline_stop(entity); 527 + media_pipeline_stop(entity); 528 528 fimc->streaming = false; 529 529 } 530 530 fimc_lite_stop_capture(fimc, false); ··· 832 832 if (fimc_lite_active(fimc)) 833 833 return -EBUSY; 834 834 835 - ret = media_entity_pipeline_start(entity, &fimc->ve.pipe->mp); 835 + ret = media_pipeline_start(entity, &fimc->ve.pipe->mp); 836 836 if (ret < 0) 837 837 return ret; 838 838 ··· 849 849 } 850 850 851 851 err_p_stop: 852 - media_entity_pipeline_stop(entity); 852 + media_pipeline_stop(entity); 853 853 return 0; 854 854 } 855 855 ··· 863 863 if (ret < 0) 864 864 return ret; 865 865 866 - media_entity_pipeline_stop(&fimc->ve.vdev.entity); 866 + media_pipeline_stop(&fimc->ve.vdev.entity); 867 867 fimc->streaming = false; 868 868 return 0; 869 869 }
+8 -8
drivers/media/platform/exynos4-is/media-dev.c
··· 1117 1117 1118 1118 /* Locking: called with entity->graph_obj.mdev->graph_mutex mutex held. */ 1119 1119 static int __fimc_md_modify_pipelines(struct media_entity *entity, bool enable, 1120 - struct media_entity_graph *graph) 1120 + struct media_graph *graph) 1121 1121 { 1122 1122 struct media_entity *entity_err = entity; 1123 1123 int ret; ··· 1128 1128 * through active links. This is needed as we cannot power on/off the 1129 1129 * subdevs in random order. 1130 1130 */ 1131 - media_entity_graph_walk_start(graph, entity); 1131 + media_graph_walk_start(graph, entity); 1132 1132 1133 - while ((entity = media_entity_graph_walk_next(graph))) { 1133 + while ((entity = media_graph_walk_next(graph))) { 1134 1134 if (!is_media_entity_v4l2_video_device(entity)) 1135 1135 continue; 1136 1136 ··· 1143 1143 return 0; 1144 1144 1145 1145 err: 1146 - media_entity_graph_walk_start(graph, entity_err); 1146 + media_graph_walk_start(graph, entity_err); 1147 1147 1148 - while ((entity_err = media_entity_graph_walk_next(graph))) { 1148 + while ((entity_err = media_graph_walk_next(graph))) { 1149 1149 if (!is_media_entity_v4l2_video_device(entity_err)) 1150 1150 continue; 1151 1151 ··· 1161 1161 static int fimc_md_link_notify(struct media_link *link, unsigned int flags, 1162 1162 unsigned int notification) 1163 1163 { 1164 - struct media_entity_graph *graph = 1164 + struct media_graph *graph = 1165 1165 &container_of(link->graph_obj.mdev, struct fimc_md, 1166 1166 media_dev)->link_setup_graph; 1167 1167 struct media_entity *sink = link->sink->entity; ··· 1169 1169 1170 1170 /* Before link disconnection */ 1171 1171 if (notification == MEDIA_DEV_NOTIFY_PRE_LINK_CH) { 1172 - ret = media_entity_graph_walk_init(graph, 1172 + ret = media_graph_walk_init(graph, 1173 1173 link->graph_obj.mdev); 1174 1174 if (ret) 1175 1175 return ret; ··· 1183 1183 } else if (notification == MEDIA_DEV_NOTIFY_POST_LINK_CH) { 1184 1184 if (link->flags & MEDIA_LNK_FL_ENABLED) 1185 1185 ret = __fimc_md_modify_pipelines(sink, true, graph); 1186 - media_entity_graph_walk_cleanup(graph); 1186 + media_graph_walk_cleanup(graph); 1187 1187 } 1188 1188 1189 1189 return ret ? -EPIPE : 0;
+1 -1
drivers/media/platform/exynos4-is/media-dev.h
··· 154 154 bool user_subdev_api; 155 155 spinlock_t slock; 156 156 struct list_head pipelines; 157 - struct media_entity_graph link_setup_graph; 157 + struct media_graph link_setup_graph; 158 158 }; 159 159 160 160 static inline
+8 -8
drivers/media/platform/omap3isp/ispvideo.c
··· 225 225 static int isp_video_get_graph_data(struct isp_video *video, 226 226 struct isp_pipeline *pipe) 227 227 { 228 - struct media_entity_graph graph; 228 + struct media_graph graph; 229 229 struct media_entity *entity = &video->video.entity; 230 230 struct media_device *mdev = entity->graph_obj.mdev; 231 231 struct isp_video *far_end = NULL; 232 232 int ret; 233 233 234 234 mutex_lock(&mdev->graph_mutex); 235 - ret = media_entity_graph_walk_init(&graph, entity->graph_obj.mdev); 235 + ret = media_graph_walk_init(&graph, entity->graph_obj.mdev); 236 236 if (ret) { 237 237 mutex_unlock(&mdev->graph_mutex); 238 238 return ret; 239 239 } 240 240 241 - media_entity_graph_walk_start(&graph, entity); 241 + media_graph_walk_start(&graph, entity); 242 242 243 - while ((entity = media_entity_graph_walk_next(&graph))) { 243 + while ((entity = media_graph_walk_next(&graph))) { 244 244 struct isp_video *__video; 245 245 246 246 media_entity_enum_set(&pipe->ent_enum, entity); ··· 261 261 262 262 mutex_unlock(&mdev->graph_mutex); 263 263 264 - media_entity_graph_walk_cleanup(&graph); 264 + media_graph_walk_cleanup(&graph); 265 265 266 266 if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { 267 267 pipe->input = far_end; ··· 1112 1112 pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]); 1113 1113 pipe->max_rate = pipe->l3_ick; 1114 1114 1115 - ret = media_entity_pipeline_start(&video->video.entity, &pipe->pipe); 1115 + ret = media_pipeline_start(&video->video.entity, &pipe->pipe); 1116 1116 if (ret < 0) 1117 1117 goto err_pipeline_start; 1118 1118 ··· 1169 1169 return 0; 1170 1170 1171 1171 err_check_format: 1172 - media_entity_pipeline_stop(&video->video.entity); 1172 + media_pipeline_stop(&video->video.entity); 1173 1173 err_pipeline_start: 1174 1174 /* TODO: Implement PM QoS */ 1175 1175 /* The DMA queue must be emptied here, otherwise CCDC interrupts that ··· 1236 1236 video->error = false; 1237 1237 1238 1238 /* TODO: Implement PM QoS */ 1239 - media_entity_pipeline_stop(&video->video.entity); 1239 + media_pipeline_stop(&video->video.entity); 1240 1240 1241 1241 media_entity_enum_cleanup(&pipe->ent_enum); 1242 1242
+3 -3
drivers/media/platform/s3c-camif/camif-capture.c
··· 856 856 if (s3c_vp_active(vp)) 857 857 return 0; 858 858 859 - ret = media_entity_pipeline_start(sensor, camif->m_pipeline); 859 + ret = media_pipeline_start(sensor, camif->m_pipeline); 860 860 if (ret < 0) 861 861 return ret; 862 862 863 863 ret = camif_pipeline_validate(camif); 864 864 if (ret < 0) { 865 - media_entity_pipeline_stop(sensor); 865 + media_pipeline_stop(sensor); 866 866 return ret; 867 867 } 868 868 ··· 886 886 887 887 ret = vb2_streamoff(&vp->vb_queue, type); 888 888 if (ret == 0) 889 - media_entity_pipeline_stop(&camif->sensor.sd->entity); 889 + media_pipeline_stop(&camif->sensor.sd->entity); 890 890 return ret; 891 891 } 892 892
+2 -2
drivers/media/platform/vsp1/vsp1_drm.c
··· 90 90 if (ret == -ETIMEDOUT) 91 91 dev_err(vsp1->dev, "DRM pipeline stop timeout\n"); 92 92 93 - media_entity_pipeline_stop(&pipe->output->entity.subdev.entity); 93 + media_pipeline_stop(&pipe->output->entity.subdev.entity); 94 94 95 95 for (i = 0; i < bru->entity.source_pad; ++i) { 96 96 vsp1->drm->inputs[i].enabled = false; ··· 196 196 if (ret < 0) 197 197 return ret; 198 198 199 - ret = media_entity_pipeline_start(&pipe->output->entity.subdev.entity, 199 + ret = media_pipeline_start(&pipe->output->entity.subdev.entity, 200 200 &pipe->pipe); 201 201 if (ret < 0) { 202 202 dev_dbg(vsp1->dev, "%s: pipeline start failed\n", __func__);
+8 -8
drivers/media/platform/vsp1/vsp1_video.c
··· 548 548 static int vsp1_video_pipeline_build(struct vsp1_pipeline *pipe, 549 549 struct vsp1_video *video) 550 550 { 551 - struct media_entity_graph graph; 551 + struct media_graph graph; 552 552 struct media_entity *entity = &video->video.entity; 553 553 struct media_device *mdev = entity->graph_obj.mdev; 554 554 unsigned int i; 555 555 int ret; 556 556 557 557 /* Walk the graph to locate the entities and video nodes. */ 558 - ret = media_entity_graph_walk_init(&graph, mdev); 558 + ret = media_graph_walk_init(&graph, mdev); 559 559 if (ret) 560 560 return ret; 561 561 562 - media_entity_graph_walk_start(&graph, entity); 562 + media_graph_walk_start(&graph, entity); 563 563 564 - while ((entity = media_entity_graph_walk_next(&graph))) { 564 + while ((entity = media_graph_walk_next(&graph))) { 565 565 struct v4l2_subdev *subdev; 566 566 struct vsp1_rwpf *rwpf; 567 567 struct vsp1_entity *e; ··· 590 590 } 591 591 } 592 592 593 - media_entity_graph_walk_cleanup(&graph); 593 + media_graph_walk_cleanup(&graph); 594 594 595 595 /* We need one output and at least one input. */ 596 596 if (pipe->num_inputs == 0 || !pipe->output) ··· 848 848 } 849 849 mutex_unlock(&pipe->lock); 850 850 851 - media_entity_pipeline_stop(&video->video.entity); 851 + media_pipeline_stop(&video->video.entity); 852 852 vsp1_video_pipeline_put(pipe); 853 853 854 854 /* Remove all buffers from the IRQ queue. */ ··· 980 980 return PTR_ERR(pipe); 981 981 } 982 982 983 - ret = __media_entity_pipeline_start(&video->video.entity, &pipe->pipe); 983 + ret = __media_pipeline_start(&video->video.entity, &pipe->pipe); 984 984 if (ret < 0) { 985 985 mutex_unlock(&mdev->graph_mutex); 986 986 goto err_pipe; ··· 1003 1003 return 0; 1004 1004 1005 1005 err_stop: 1006 - media_entity_pipeline_stop(&video->video.entity); 1006 + media_pipeline_stop(&video->video.entity); 1007 1007 err_pipe: 1008 1008 vsp1_video_pipeline_put(pipe); 1009 1009 return ret;
+8 -8
drivers/media/platform/xilinx/xilinx-dma.c
··· 177 177 static int xvip_pipeline_validate(struct xvip_pipeline *pipe, 178 178 struct xvip_dma *start) 179 179 { 180 - struct media_entity_graph graph; 180 + struct media_graph graph; 181 181 struct media_entity *entity = &start->video.entity; 182 182 struct media_device *mdev = entity->graph_obj.mdev; 183 183 unsigned int num_inputs = 0; ··· 187 187 mutex_lock(&mdev->graph_mutex); 188 188 189 189 /* Walk the graph to locate the video nodes. */ 190 - ret = media_entity_graph_walk_init(&graph, entity->graph_obj.mdev); 190 + ret = media_graph_walk_init(&graph, entity->graph_obj.mdev); 191 191 if (ret) { 192 192 mutex_unlock(&mdev->graph_mutex); 193 193 return ret; 194 194 } 195 195 196 - media_entity_graph_walk_start(&graph, entity); 196 + media_graph_walk_start(&graph, entity); 197 197 198 - while ((entity = media_entity_graph_walk_next(&graph))) { 198 + while ((entity = media_graph_walk_next(&graph))) { 199 199 struct xvip_dma *dma; 200 200 201 201 if (entity->function != MEDIA_ENT_F_IO_V4L) ··· 213 213 214 214 mutex_unlock(&mdev->graph_mutex); 215 215 216 - media_entity_graph_walk_cleanup(&graph); 216 + media_graph_walk_cleanup(&graph); 217 217 218 218 /* We need exactly one output and zero or one input. */ 219 219 if (num_outputs != 1 || num_inputs > 1) ··· 409 409 pipe = dma->video.entity.pipe 410 410 ? to_xvip_pipeline(&dma->video.entity) : &dma->pipe; 411 411 412 - ret = media_entity_pipeline_start(&dma->video.entity, &pipe->pipe); 412 + ret = media_pipeline_start(&dma->video.entity, &pipe->pipe); 413 413 if (ret < 0) 414 414 goto error; 415 415 ··· 435 435 return 0; 436 436 437 437 error_stop: 438 - media_entity_pipeline_stop(&dma->video.entity); 438 + media_pipeline_stop(&dma->video.entity); 439 439 440 440 error: 441 441 /* Give back all queued buffers to videobuf2. */ ··· 463 463 464 464 /* Cleanup the pipeline and mark it as being stopped. */ 465 465 xvip_pipeline_cleanup(pipe); 466 - media_entity_pipeline_stop(&dma->video.entity); 466 + media_pipeline_stop(&dma->video.entity); 467 467 468 468 /* Give back all queued buffers to videobuf2. */ 469 469 spin_lock_irq(&dma->queued_lock);
+2 -2
drivers/media/usb/au0828/au0828-core.c
··· 393 393 goto end; 394 394 } 395 395 396 - ret = __media_entity_pipeline_start(entity, pipe); 396 + ret = __media_pipeline_start(entity, pipe); 397 397 if (ret) { 398 398 pr_err("Start Pipeline: %s->%s Error %d\n", 399 399 source->name, entity->name, ret); ··· 447 447 */ 448 448 if (dev->active_link_owner != entity) 449 449 goto end; 450 - __media_entity_pipeline_stop(entity); 450 + __media_pipeline_stop(entity); 451 451 ret = __media_entity_setup_link(dev->active_link, 0); 452 452 if (ret) 453 453 pr_err("Deactivate link Error %d\n", ret);
+9 -9
drivers/media/v4l2-core/v4l2-mc.c
··· 256 256 * Return the total number of users of all video device nodes in the pipeline. 257 257 */ 258 258 static int pipeline_pm_use_count(struct media_entity *entity, 259 - struct media_entity_graph *graph) 259 + struct media_graph *graph) 260 260 { 261 261 int use = 0; 262 262 263 - media_entity_graph_walk_start(graph, entity); 263 + media_graph_walk_start(graph, entity); 264 264 265 - while ((entity = media_entity_graph_walk_next(graph))) { 265 + while ((entity = media_graph_walk_next(graph))) { 266 266 if (is_media_entity_v4l2_video_device(entity)) 267 267 use += entity->use_count; 268 268 } ··· 315 315 * Return 0 on success or a negative error code on failure. 316 316 */ 317 317 static int pipeline_pm_power(struct media_entity *entity, int change, 318 - struct media_entity_graph *graph) 318 + struct media_graph *graph) 319 319 { 320 320 struct media_entity *first = entity; 321 321 int ret = 0; ··· 323 323 if (!change) 324 324 return 0; 325 325 326 - media_entity_graph_walk_start(graph, entity); 326 + media_graph_walk_start(graph, entity); 327 327 328 - while (!ret && (entity = media_entity_graph_walk_next(graph))) 328 + while (!ret && (entity = media_graph_walk_next(graph))) 329 329 if (is_media_entity_v4l2_subdev(entity)) 330 330 ret = pipeline_pm_power_one(entity, change); 331 331 332 332 if (!ret) 333 333 return ret; 334 334 335 - media_entity_graph_walk_start(graph, first); 335 + media_graph_walk_start(graph, first); 336 336 337 - while ((first = media_entity_graph_walk_next(graph)) 337 + while ((first = media_graph_walk_next(graph)) 338 338 && first != entity) 339 339 if (is_media_entity_v4l2_subdev(first)) 340 340 pipeline_pm_power_one(first, -change); ··· 368 368 int v4l2_pipeline_link_notify(struct media_link *link, u32 flags, 369 369 unsigned int notification) 370 370 { 371 - struct media_entity_graph *graph = &link->graph_obj.mdev->pm_count_walk; 371 + struct media_graph *graph = &link->graph_obj.mdev->pm_count_walk; 372 372 struct media_entity *source = link->source->entity; 373 373 struct media_entity *sink = link->sink->entity; 374 374 int source_use;
+12 -13
drivers/staging/media/davinci_vpfe/vpfe_video.c
··· 129 129 /* make a note of pipeline details */ 130 130 static int vpfe_prepare_pipeline(struct vpfe_video_device *video) 131 131 { 132 - struct media_entity_graph graph; 132 + struct media_graph graph; 133 133 struct media_entity *entity = &video->video_dev.entity; 134 134 struct media_device *mdev = entity->graph_obj.mdev; 135 135 struct vpfe_pipeline *pipe = &video->pipe; ··· 145 145 pipe->outputs[pipe->output_num++] = video; 146 146 147 147 mutex_lock(&mdev->graph_mutex); 148 - ret = media_entity_graph_walk_init(&graph, entity->graph_obj.mdev); 148 + ret = media_graph_walk_init(&graph, entity->graph_obj.mdev); 149 149 if (ret) { 150 150 mutex_unlock(&mdev->graph_mutex); 151 151 return -ENOMEM; 152 152 } 153 - media_entity_graph_walk_start(&graph, entity); 154 - while ((entity = media_entity_graph_walk_next(&graph))) { 153 + media_graph_walk_start(&graph, entity); 154 + while ((entity = media_graph_walk_next(&graph))) { 155 155 if (entity == &video->video_dev.entity) 156 156 continue; 157 157 if (!is_media_entity_v4l2_video_device(entity)) ··· 162 162 else 163 163 pipe->outputs[pipe->output_num++] = far_end; 164 164 } 165 - media_entity_graph_walk_cleanup(&graph); 165 + media_graph_walk_cleanup(&graph); 166 166 mutex_unlock(&mdev->graph_mutex); 167 167 168 168 return 0; ··· 300 300 301 301 mdev = entity->graph_obj.mdev; 302 302 mutex_lock(&mdev->graph_mutex); 303 - ret = media_entity_graph_walk_init(&pipe->graph, 304 - entity->graph_obj.mdev); 303 + ret = media_graph_walk_init(&pipe->graph, entity->graph_obj.mdev); 305 304 if (ret) 306 305 goto out; 307 - media_entity_graph_walk_start(&pipe->graph, entity); 308 - while ((entity = media_entity_graph_walk_next(&pipe->graph))) { 306 + media_graph_walk_start(&pipe->graph, entity); 307 + while ((entity = media_graph_walk_next(&pipe->graph))) { 309 308 310 309 if (!is_media_entity_v4l2_subdev(entity)) 311 310 continue; ··· 315 316 } 316 317 out: 317 318 if (ret) 318 - media_entity_graph_walk_cleanup(&pipe->graph); 319 + media_graph_walk_cleanup(&pipe->graph); 319 320 mutex_unlock(&mdev->graph_mutex); 320 321 return ret; 321 322 } ··· 345 346 346 347 mdev = entity->graph_obj.mdev; 347 348 mutex_lock(&mdev->graph_mutex); 348 - media_entity_graph_walk_start(&pipe->graph, entity); 349 + media_graph_walk_start(&pipe->graph, entity); 349 350 350 - while ((entity = media_entity_graph_walk_next(&pipe->graph))) { 351 + while ((entity = media_graph_walk_next(&pipe->graph))) { 351 352 352 353 if (!is_media_entity_v4l2_subdev(entity)) 353 354 continue; ··· 358 359 } 359 360 mutex_unlock(&mdev->graph_mutex); 360 361 361 - media_entity_graph_walk_cleanup(&pipe->graph); 362 + media_graph_walk_cleanup(&pipe->graph); 362 363 return ret ? -ETIMEDOUT : 0; 363 364 } 364 365
+1 -1
drivers/staging/media/davinci_vpfe/vpfe_video.h
··· 52 52 struct vpfe_pipeline { 53 53 /* media pipeline */ 54 54 struct media_pipeline *pipe; 55 - struct media_entity_graph graph; 55 + struct media_graph graph; 56 56 /* state of the pipeline, continuous, 57 57 * single-shot or stopped 58 58 */
+16 -16
drivers/staging/media/omap4iss/iss_video.c
··· 205 205 static struct iss_video * 206 206 iss_video_far_end(struct iss_video *video) 207 207 { 208 - struct media_entity_graph graph; 208 + struct media_graph graph; 209 209 struct media_entity *entity = &video->video.entity; 210 210 struct media_device *mdev = entity->graph_obj.mdev; 211 211 struct iss_video *far_end = NULL; 212 212 213 213 mutex_lock(&mdev->graph_mutex); 214 214 215 - if (media_entity_graph_walk_init(&graph, mdev)) { 215 + if (media_graph_walk_init(&graph, mdev)) { 216 216 mutex_unlock(&mdev->graph_mutex); 217 217 return NULL; 218 218 } 219 219 220 - media_entity_graph_walk_start(&graph, entity); 220 + media_graph_walk_start(&graph, entity); 221 221 222 - while ((entity = media_entity_graph_walk_next(&graph))) { 222 + while ((entity = media_graph_walk_next(&graph))) { 223 223 if (entity == &video->video.entity) 224 224 continue; 225 225 ··· 235 235 236 236 mutex_unlock(&mdev->graph_mutex); 237 237 238 - media_entity_graph_walk_cleanup(&graph); 238 + media_graph_walk_cleanup(&graph); 239 239 240 240 return far_end; 241 241 } ··· 854 854 { 855 855 struct iss_video_fh *vfh = to_iss_video_fh(fh); 856 856 struct iss_video *video = video_drvdata(file); 857 - struct media_entity_graph graph; 857 + struct media_graph graph; 858 858 struct media_entity *entity = &video->video.entity; 859 859 enum iss_pipeline_state state; 860 860 struct iss_pipeline *pipe; ··· 880 880 if (ret) 881 881 goto err_graph_walk_init; 882 882 883 - ret = media_entity_graph_walk_init(&graph, entity->graph_obj.mdev); 883 + ret = media_graph_walk_init(&graph, entity->graph_obj.mdev); 884 884 if (ret) 885 885 goto err_graph_walk_init; 886 886 887 887 if (video->iss->pdata->set_constraints) 888 888 video->iss->pdata->set_constraints(video->iss, true); 889 889 890 - ret = media_entity_pipeline_start(entity, &pipe->pipe); 890 + ret = media_pipeline_start(entity, &pipe->pipe); 891 891 if (ret < 0) 892 - goto err_media_entity_pipeline_start; 892 + goto err_media_pipeline_start; 893 893 894 - media_entity_graph_walk_start(&graph, entity); 895 - while ((entity = media_entity_graph_walk_next(&graph))) 894 + media_graph_walk_start(&graph, entity); 895 + while ((entity = media_graph_walk_next(&graph))) 896 896 media_entity_enum_set(&pipe->ent_enum, entity); 897 897 898 898 /* Verify that the currently configured format matches the output of ··· 963 963 spin_unlock_irqrestore(&video->qlock, flags); 964 964 } 965 965 966 - media_entity_graph_walk_cleanup(&graph); 966 + media_graph_walk_cleanup(&graph); 967 967 968 968 mutex_unlock(&video->stream_lock); 969 969 ··· 972 972 err_omap4iss_set_stream: 973 973 vb2_streamoff(&vfh->queue, type); 974 974 err_iss_video_check_format: 975 - media_entity_pipeline_stop(&video->video.entity); 976 - err_media_entity_pipeline_start: 975 + media_pipeline_stop(&video->video.entity); 976 + err_media_pipeline_start: 977 977 if (video->iss->pdata->set_constraints) 978 978 video->iss->pdata->set_constraints(video->iss, false); 979 979 video->queue = NULL; 980 980 981 - media_entity_graph_walk_cleanup(&graph); 981 + media_graph_walk_cleanup(&graph); 982 982 983 983 err_graph_walk_init: 984 984 media_entity_enum_cleanup(&pipe->ent_enum); ··· 1026 1026 1027 1027 if (video->iss->pdata->set_constraints) 1028 1028 video->iss->pdata->set_constraints(video->iss, false); 1029 - media_entity_pipeline_stop(&video->video.entity); 1029 + media_pipeline_stop(&video->video.entity); 1030 1030 1031 1031 done: 1032 1032 mutex_unlock(&video->stream_lock);
+1 -1
include/media/media-device.h
··· 150 150 151 151 /* Serializes graph operations. */ 152 152 struct mutex graph_mutex; 153 - struct media_entity_graph pm_count_walk; 153 + struct media_graph pm_count_walk; 154 154 155 155 void *source_priv; 156 156 int (*enable_source)(struct media_entity *entity,
+32 -33
include/media/media-entity.h
··· 82 82 }; 83 83 84 84 /** 85 - * struct media_entity_graph - Media graph traversal state 85 + * struct media_graph - Media graph traversal state 86 86 * 87 87 * @stack: Graph traversal stack; the stack contains information 88 88 * on the path the media entities to be walked and the ··· 90 90 * @ent_enum: Visited entities 91 91 * @top: The top of the stack 92 92 */ 93 - struct media_entity_graph { 93 + struct media_graph { 94 94 struct { 95 95 struct media_entity *entity; 96 96 struct list_head *link; ··· 108 108 */ 109 109 struct media_pipeline { 110 110 int streaming_count; 111 - struct media_entity_graph graph; 111 + struct media_graph graph; 112 112 }; 113 113 114 114 /** ··· 175 175 * return an error, in which case link setup will be 176 176 * cancelled. Optional. 177 177 * @link_validate: Return whether a link is valid from the entity point of 178 - * view. The media_entity_pipeline_start() function 178 + * view. The media_pipeline_start() function 179 179 * validates all links by calling this operation. Optional. 180 180 * 181 181 * .. note:: ··· 816 816 struct media_entity *media_entity_get(struct media_entity *entity); 817 817 818 818 /** 819 - * media_entity_graph_walk_init - Allocate resources used by graph walk. 819 + * media_graph_walk_init - Allocate resources used by graph walk. 820 820 * 821 821 * @graph: Media graph structure that will be used to walk the graph 822 822 * @mdev: Pointer to the &media_device that contains the object 823 823 */ 824 - __must_check int media_entity_graph_walk_init( 825 - struct media_entity_graph *graph, struct media_device *mdev); 824 + __must_check int media_graph_walk_init( 825 + struct media_graph *graph, struct media_device *mdev); 826 826 827 827 /** 828 - * media_entity_graph_walk_cleanup - Release resources used by graph walk. 828 + * media_graph_walk_cleanup - Release resources used by graph walk. 829 829 * 830 830 * @graph: Media graph structure that will be used to walk the graph 831 831 */ 832 - void media_entity_graph_walk_cleanup(struct media_entity_graph *graph); 832 + void media_graph_walk_cleanup(struct media_graph *graph); 833 833 834 834 /** 835 835 * media_entity_put - Release the reference to the parent module ··· 843 843 void media_entity_put(struct media_entity *entity); 844 844 845 845 /** 846 - * media_entity_graph_walk_start - Start walking the media graph at a 846 + * media_graph_walk_start - Start walking the media graph at a 847 847 * given entity 848 848 * 849 849 * @graph: Media graph structure that will be used to walk the graph 850 850 * @entity: Starting entity 851 851 * 852 - * Before using this function, media_entity_graph_walk_init() must be 852 + * Before using this function, media_graph_walk_init() must be 853 853 * used to allocate resources used for walking the graph. This 854 854 * function initializes the graph traversal structure to walk the 855 855 * entities graph starting at the given entity. The traversal 856 856 * structure must not be modified by the caller during graph 857 857 * traversal. After the graph walk, the resources must be released 858 - * using media_entity_graph_walk_cleanup(). 858 + * using media_graph_walk_cleanup(). 859 859 */ 860 - void media_entity_graph_walk_start(struct media_entity_graph *graph, 861 - struct media_entity *entity); 860 + void media_graph_walk_start(struct media_graph *graph, 861 + struct media_entity *entity); 862 862 863 863 /** 864 - * media_entity_graph_walk_next - Get the next entity in the graph 864 + * media_graph_walk_next - Get the next entity in the graph 865 865 * @graph: Media graph structure 866 866 * 867 867 * Perform a depth-first traversal of the given media entities graph. 868 868 * 869 869 * The graph structure must have been previously initialized with a call to 870 - * media_entity_graph_walk_start(). 870 + * media_graph_walk_start(). 871 871 * 872 872 * Return: returns the next entity in the graph or %NULL if the whole graph 873 873 * have been traversed. 874 874 */ 875 - struct media_entity * 876 - media_entity_graph_walk_next(struct media_entity_graph *graph); 875 + struct media_entity *media_graph_walk_next(struct media_graph *graph); 877 876 878 877 /** 879 - * media_entity_pipeline_start - Mark a pipeline as streaming 878 + * media_pipeline_start - Mark a pipeline as streaming 880 879 * @entity: Starting entity 881 880 * @pipe: Media pipeline to be assigned to all entities in the pipeline. 882 881 * ··· 884 885 * to every entity in the pipeline and stored in the media_entity pipe field. 885 886 * 886 887 * Calls to this function can be nested, in which case the same number of 887 - * media_entity_pipeline_stop() calls will be required to stop streaming. The 888 + * media_pipeline_stop() calls will be required to stop streaming. The 888 889 * pipeline pointer must be identical for all nested calls to 889 - * media_entity_pipeline_start(). 890 + * media_pipeline_start(). 890 891 */ 891 - __must_check int media_entity_pipeline_start(struct media_entity *entity, 892 - struct media_pipeline *pipe); 892 + __must_check int media_pipeline_start(struct media_entity *entity, 893 + struct media_pipeline *pipe); 893 894 /** 894 - * __media_entity_pipeline_start - Mark a pipeline as streaming 895 + * __media_pipeline_start - Mark a pipeline as streaming 895 896 * 896 897 * @entity: Starting entity 897 898 * @pipe: Media pipeline to be assigned to all entities in the pipeline. 898 899 * 899 - * ..note:: This is the non-locking version of media_entity_pipeline_start() 900 + * ..note:: This is the non-locking version of media_pipeline_start() 900 901 */ 901 - __must_check int __media_entity_pipeline_start(struct media_entity *entity, 902 - struct media_pipeline *pipe); 902 + __must_check int __media_pipeline_start(struct media_entity *entity, 903 + struct media_pipeline *pipe); 903 904 904 905 /** 905 - * media_entity_pipeline_stop - Mark a pipeline as not streaming 906 + * media_pipeline_stop - Mark a pipeline as not streaming 906 907 * @entity: Starting entity 907 908 * 908 909 * Mark all entities connected to a given entity through enabled links, either 909 910 * directly or indirectly, as not streaming. The media_entity pipe field is 910 911 * reset to %NULL. 911 912 * 912 - * If multiple calls to media_entity_pipeline_start() have been made, the same 913 + * If multiple calls to media_pipeline_start() have been made, the same 913 914 * number of calls to this function are required to mark the pipeline as not 914 915 * streaming. 915 916 */ 916 - void media_entity_pipeline_stop(struct media_entity *entity); 917 + void media_pipeline_stop(struct media_entity *entity); 917 918 918 919 /** 919 - * __media_entity_pipeline_stop - Mark a pipeline as not streaming 920 + * __media_pipeline_stop - Mark a pipeline as not streaming 920 921 * 921 922 * @entity: Starting entity 922 923 * 923 - * .. note:: This is the non-locking version of media_entity_pipeline_stop() 924 + * .. note:: This is the non-locking version of media_pipeline_stop() 924 925 */ 925 - void __media_entity_pipeline_stop(struct media_entity *entity); 926 + void __media_pipeline_stop(struct media_entity *entity); 926 927 927 928 /** 928 929 * media_devnode_create() - creates and initializes a device node interface