Skip to content

Commit 20b8522

Browse files
Sakari Ailusmchehab
authored andcommitted
[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 <[email protected]> Acked-by: Laurent Pinchart <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 12030f4 commit 20b8522

File tree

20 files changed

+174
-177
lines changed

20 files changed

+174
-177
lines changed

Documentation/media/kapi/mc-core.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,13 @@ framework provides a depth-first graph traversal API for that purpose.
162162
currently defined as 16.
163163

164164
Drivers initiate a graph traversal by calling
165-
:c:func:`media_entity_graph_walk_start()`
165+
:c:func:`media_graph_walk_start()`
166166

167167
The graph structure, provided by the caller, is initialized to start graph
168168
traversal at the given entity.
169169

170170
Drivers can then retrieve the next entity by calling
171-
:c:func:`media_entity_graph_walk_next()`
171+
:c:func:`media_graph_walk_next()`
172172

173173
When the graph traversal is complete the function will return ``NULL``.
174174

@@ -206,7 +206,7 @@ Pipelines and media streams
206206

207207
When starting streaming, drivers must notify all entities in the pipeline to
208208
prevent link states from being modified during streaming by calling
209-
:c:func:`media_entity_pipeline_start()`.
209+
:c:func:`media_pipeline_start()`.
210210

211211
The function will mark all entities connected to the given entity through
212212
enabled links, either directly or indirectly, as streaming.
@@ -218,17 +218,17 @@ in higher-level pipeline structures and can then access the
218218
pipeline through the struct :c:type:`media_entity`
219219
pipe field.
220220

221-
Calls to :c:func:`media_entity_pipeline_start()` can be nested.
221+
Calls to :c:func:`media_pipeline_start()` can be nested.
222222
The pipeline pointer must be identical for all nested calls to the function.
223223

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,
225225
it will clean up any of the changes it did by itself.
226226

227227
When stopping the stream, drivers must notify the entities with
228-
:c:func:`media_entity_pipeline_stop()`.
228+
:c:func:`media_pipeline_stop()`.
229229

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
232232
are required to stop streaming.
233233
The :c:type:`media_entity`.\ ``pipe`` field is reset to ``NULL`` on the last
234234
nested stop call.
@@ -245,7 +245,7 @@ operation must be done with the media_device graph_mutex held.
245245
Link validation
246246
^^^^^^^^^^^^^^^
247247

248-
Link validation is performed by :c:func:`media_entity_pipeline_start()`
248+
Link validation is performed by :c:func:`media_pipeline_start()`
249249
for any entity which has sink pads in the pipeline. The
250250
:c:type:`media_entity`.\ ``link_validate()`` callback is used for that
251251
purpose. In ``link_validate()`` callback, entity driver should check

drivers/media/media-device.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,19 +597,19 @@ int __must_check media_device_register_entity(struct media_device *mdev,
597597

598598
if (mdev->entity_internal_idx_max
599599
>= mdev->pm_count_walk.ent_enum.idx_max) {
600-
struct media_entity_graph new = { .top = 0 };
600+
struct media_graph new = { .top = 0 };
601601

602602
/*
603603
* Initialise the new graph walk before cleaning up
604604
* the old one in order not to spoil the graph walk
605605
* object of the media device if graph walk init fails.
606606
*/
607-
ret = media_entity_graph_walk_init(&new, mdev);
607+
ret = media_graph_walk_init(&new, mdev);
608608
if (ret) {
609609
mutex_unlock(&mdev->graph_mutex);
610610
return ret;
611611
}
612-
media_entity_graph_walk_cleanup(&mdev->pm_count_walk);
612+
media_graph_walk_cleanup(&mdev->pm_count_walk);
613613
mdev->pm_count_walk = new;
614614
}
615615
mutex_unlock(&mdev->graph_mutex);
@@ -691,7 +691,7 @@ void media_device_cleanup(struct media_device *mdev)
691691
{
692692
ida_destroy(&mdev->entity_internal_idx);
693693
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);
695695
mutex_destroy(&mdev->graph_mutex);
696696
}
697697
EXPORT_SYMBOL_GPL(media_device_cleanup);

drivers/media/media-entity.c

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ media_entity_other(struct media_entity *entity, struct media_link *link)
254254
}
255255

256256
/* 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,
258258
struct media_entity *entity)
259259
{
260260
if (graph->top == MEDIA_ENTITY_ENUM_MAX_DEPTH - 1) {
@@ -266,7 +266,7 @@ static void stack_push(struct media_entity_graph *graph,
266266
graph->stack[graph->top].entity = entity;
267267
}
268268

269-
static struct media_entity *stack_pop(struct media_entity_graph *graph)
269+
static struct media_entity *stack_pop(struct media_graph *graph)
270270
{
271271
struct media_entity *entity;
272272

@@ -285,35 +285,35 @@ static struct media_entity *stack_pop(struct media_entity_graph *graph)
285285
#define MEDIA_ENTITY_MAX_PADS 512
286286

287287
/**
288-
* media_entity_graph_walk_init - Allocate resources for graph walk
288+
* media_graph_walk_init - Allocate resources for graph walk
289289
* @graph: Media graph structure that will be used to walk the graph
290290
* @mdev: Media device
291291
*
292292
* Reserve resources for graph walk in media device's current
293293
* state. The memory must be released using
294-
* media_entity_graph_walk_free().
294+
* media_graph_walk_free().
295295
*
296296
* Returns error on failure, zero on success.
297297
*/
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)
300300
{
301301
return media_entity_enum_init(&graph->ent_enum, mdev);
302302
}
303-
EXPORT_SYMBOL_GPL(media_entity_graph_walk_init);
303+
EXPORT_SYMBOL_GPL(media_graph_walk_init);
304304

305305
/**
306-
* media_entity_graph_walk_cleanup - Release resources related to graph walking
306+
* media_graph_walk_cleanup - Release resources related to graph walking
307307
* @graph: Media graph structure that was used to walk the graph
308308
*/
309-
void media_entity_graph_walk_cleanup(struct media_entity_graph *graph)
309+
void media_graph_walk_cleanup(struct media_graph *graph)
310310
{
311311
media_entity_enum_cleanup(&graph->ent_enum);
312312
}
313-
EXPORT_SYMBOL_GPL(media_entity_graph_walk_cleanup);
313+
EXPORT_SYMBOL_GPL(media_graph_walk_cleanup);
314314

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)
317317
{
318318
media_entity_enum_zero(&graph->ent_enum);
319319
media_entity_enum_set(&graph->ent_enum, entity);
@@ -322,10 +322,9 @@ void media_entity_graph_walk_start(struct media_entity_graph *graph,
322322
graph->stack[graph->top].entity = NULL;
323323
stack_push(graph, entity);
324324
}
325-
EXPORT_SYMBOL_GPL(media_entity_graph_walk_start);
325+
EXPORT_SYMBOL_GPL(media_graph_walk_start);
326326

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)
329328
{
330329
if (stack_top(graph) == NULL)
331330
return NULL;
@@ -364,30 +363,30 @@ media_entity_graph_walk_next(struct media_entity_graph *graph)
364363

365364
return stack_pop(graph);
366365
}
367-
EXPORT_SYMBOL_GPL(media_entity_graph_walk_next);
366+
EXPORT_SYMBOL_GPL(media_graph_walk_next);
368367

369368
/* -----------------------------------------------------------------------------
370369
* Pipeline management
371370
*/
372371

373-
__must_check int __media_entity_pipeline_start(struct media_entity *entity,
374-
struct media_pipeline *pipe)
372+
__must_check int __media_pipeline_start(struct media_entity *entity,
373+
struct media_pipeline *pipe)
375374
{
376375
struct media_device *mdev = entity->graph_obj.mdev;
377-
struct media_entity_graph *graph = &pipe->graph;
376+
struct media_graph *graph = &pipe->graph;
378377
struct media_entity *entity_err = entity;
379378
struct media_link *link;
380379
int ret;
381380

382381
if (!pipe->streaming_count++) {
383-
ret = media_entity_graph_walk_init(&pipe->graph, mdev);
382+
ret = media_graph_walk_init(&pipe->graph, mdev);
384383
if (ret)
385384
goto error_graph_walk_start;
386385
}
387386

388-
media_entity_graph_walk_start(&pipe->graph, entity);
387+
media_graph_walk_start(&pipe->graph, entity);
389388

390-
while ((entity = media_entity_graph_walk_next(graph))) {
389+
while ((entity = media_graph_walk_next(graph))) {
391390
DECLARE_BITMAP(active, MEDIA_ENTITY_MAX_PADS);
392391
DECLARE_BITMAP(has_no_links, MEDIA_ENTITY_MAX_PADS);
393392

@@ -466,9 +465,9 @@ __must_check int __media_entity_pipeline_start(struct media_entity *entity,
466465
* Link validation on graph failed. We revert what we did and
467466
* return the error.
468467
*/
469-
media_entity_graph_walk_start(graph, entity_err);
468+
media_graph_walk_start(graph, entity_err);
470469

471-
while ((entity_err = media_entity_graph_walk_next(graph))) {
470+
while ((entity_err = media_graph_walk_next(graph))) {
472471
/* Sanity check for negative stream_count */
473472
if (!WARN_ON_ONCE(entity_err->stream_count <= 0)) {
474473
entity_err->stream_count--;
@@ -486,35 +485,35 @@ __must_check int __media_entity_pipeline_start(struct media_entity *entity,
486485

487486
error_graph_walk_start:
488487
if (!--pipe->streaming_count)
489-
media_entity_graph_walk_cleanup(graph);
488+
media_graph_walk_cleanup(graph);
490489

491490
return ret;
492491
}
493-
EXPORT_SYMBOL_GPL(__media_entity_pipeline_start);
492+
EXPORT_SYMBOL_GPL(__media_pipeline_start);
494493

495-
__must_check int media_entity_pipeline_start(struct media_entity *entity,
496-
struct media_pipeline *pipe)
494+
__must_check int media_pipeline_start(struct media_entity *entity,
495+
struct media_pipeline *pipe)
497496
{
498497
struct media_device *mdev = entity->graph_obj.mdev;
499498
int ret;
500499

501500
mutex_lock(&mdev->graph_mutex);
502-
ret = __media_entity_pipeline_start(entity, pipe);
501+
ret = __media_pipeline_start(entity, pipe);
503502
mutex_unlock(&mdev->graph_mutex);
504503
return ret;
505504
}
506-
EXPORT_SYMBOL_GPL(media_entity_pipeline_start);
505+
EXPORT_SYMBOL_GPL(media_pipeline_start);
507506

508-
void __media_entity_pipeline_stop(struct media_entity *entity)
507+
void __media_pipeline_stop(struct media_entity *entity)
509508
{
510-
struct media_entity_graph *graph = &entity->pipe->graph;
509+
struct media_graph *graph = &entity->pipe->graph;
511510
struct media_pipeline *pipe = entity->pipe;
512511

513512

514513
WARN_ON(!pipe->streaming_count);
515-
media_entity_graph_walk_start(graph, entity);
514+
media_graph_walk_start(graph, entity);
516515

517-
while ((entity = media_entity_graph_walk_next(graph))) {
516+
while ((entity = media_graph_walk_next(graph))) {
518517
/* Sanity check for negative stream_count */
519518
if (!WARN_ON_ONCE(entity->stream_count <= 0)) {
520519
entity->stream_count--;
@@ -524,20 +523,20 @@ void __media_entity_pipeline_stop(struct media_entity *entity)
524523
}
525524

526525
if (!--pipe->streaming_count)
527-
media_entity_graph_walk_cleanup(graph);
526+
media_graph_walk_cleanup(graph);
528527

529528
}
530-
EXPORT_SYMBOL_GPL(__media_entity_pipeline_stop);
529+
EXPORT_SYMBOL_GPL(__media_pipeline_stop);
531530

532-
void media_entity_pipeline_stop(struct media_entity *entity)
531+
void media_pipeline_stop(struct media_entity *entity)
533532
{
534533
struct media_device *mdev = entity->graph_obj.mdev;
535534

536535
mutex_lock(&mdev->graph_mutex);
537-
__media_entity_pipeline_stop(entity);
536+
__media_pipeline_stop(entity);
538537
mutex_unlock(&mdev->graph_mutex);
539538
}
540-
EXPORT_SYMBOL_GPL(media_entity_pipeline_stop);
539+
EXPORT_SYMBOL_GPL(media_pipeline_stop);
541540

542541
/* -----------------------------------------------------------------------------
543542
* Module use count

drivers/media/platform/exynos4-is/fimc-capture.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ static int fimc_capture_release(struct file *file)
536536
mutex_lock(&fimc->lock);
537537

538538
if (close && vc->streaming) {
539-
media_entity_pipeline_stop(&vc->ve.vdev.entity);
539+
media_pipeline_stop(&vc->ve.vdev.entity);
540540
vc->streaming = false;
541541
}
542542

@@ -1195,7 +1195,7 @@ static int fimc_cap_streamon(struct file *file, void *priv,
11951195
if (fimc_capture_active(fimc))
11961196
return -EBUSY;
11971197

1198-
ret = media_entity_pipeline_start(entity, &vc->ve.pipe->mp);
1198+
ret = media_pipeline_start(entity, &vc->ve.pipe->mp);
11991199
if (ret < 0)
12001200
return ret;
12011201

@@ -1229,7 +1229,7 @@ static int fimc_cap_streamon(struct file *file, void *priv,
12291229
}
12301230

12311231
err_p_stop:
1232-
media_entity_pipeline_stop(entity);
1232+
media_pipeline_stop(entity);
12331233
return ret;
12341234
}
12351235

@@ -1244,7 +1244,7 @@ static int fimc_cap_streamoff(struct file *file, void *priv,
12441244
if (ret < 0)
12451245
return ret;
12461246

1247-
media_entity_pipeline_stop(&vc->ve.vdev.entity);
1247+
media_pipeline_stop(&vc->ve.vdev.entity);
12481248
vc->streaming = false;
12491249
return 0;
12501250
}

drivers/media/platform/exynos4-is/fimc-isp-video.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ static int isp_video_release(struct file *file)
312312
mutex_lock(&isp->video_lock);
313313

314314
if (v4l2_fh_is_singular_file(file) && ivc->streaming) {
315-
media_entity_pipeline_stop(entity);
315+
media_pipeline_stop(entity);
316316
ivc->streaming = 0;
317317
}
318318

@@ -489,7 +489,7 @@ static int isp_video_streamon(struct file *file, void *priv,
489489
struct media_entity *me = &ve->vdev.entity;
490490
int ret;
491491

492-
ret = media_entity_pipeline_start(me, &ve->pipe->mp);
492+
ret = media_pipeline_start(me, &ve->pipe->mp);
493493
if (ret < 0)
494494
return ret;
495495

@@ -504,7 +504,7 @@ static int isp_video_streamon(struct file *file, void *priv,
504504
isp->video_capture.streaming = 1;
505505
return 0;
506506
p_stop:
507-
media_entity_pipeline_stop(me);
507+
media_pipeline_stop(me);
508508
return ret;
509509
}
510510

@@ -519,7 +519,7 @@ static int isp_video_streamoff(struct file *file, void *priv,
519519
if (ret < 0)
520520
return ret;
521521

522-
media_entity_pipeline_stop(&video->ve.vdev.entity);
522+
media_pipeline_stop(&video->ve.vdev.entity);
523523
video->streaming = 0;
524524
return 0;
525525
}

drivers/media/platform/exynos4-is/fimc-lite.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ static int fimc_lite_release(struct file *file)
524524
if (v4l2_fh_is_singular_file(file) &&
525525
atomic_read(&fimc->out_path) == FIMC_IO_DMA) {
526526
if (fimc->streaming) {
527-
media_entity_pipeline_stop(entity);
527+
media_pipeline_stop(entity);
528528
fimc->streaming = false;
529529
}
530530
fimc_lite_stop_capture(fimc, false);
@@ -832,7 +832,7 @@ static int fimc_lite_streamon(struct file *file, void *priv,
832832
if (fimc_lite_active(fimc))
833833
return -EBUSY;
834834

835-
ret = media_entity_pipeline_start(entity, &fimc->ve.pipe->mp);
835+
ret = media_pipeline_start(entity, &fimc->ve.pipe->mp);
836836
if (ret < 0)
837837
return ret;
838838

@@ -849,7 +849,7 @@ static int fimc_lite_streamon(struct file *file, void *priv,
849849
}
850850

851851
err_p_stop:
852-
media_entity_pipeline_stop(entity);
852+
media_pipeline_stop(entity);
853853
return 0;
854854
}
855855

@@ -863,7 +863,7 @@ static int fimc_lite_streamoff(struct file *file, void *priv,
863863
if (ret < 0)
864864
return ret;
865865

866-
media_entity_pipeline_stop(&fimc->ve.vdev.entity);
866+
media_pipeline_stop(&fimc->ve.vdev.entity);
867867
fimc->streaming = false;
868868
return 0;
869869
}

0 commit comments

Comments
 (0)