Change the internal namespace for links between two pads to
have the pad there.
We're also numbering it, as a common constructor is to do
things like:
if (link-port1.type != MEDIA_GRAPH_PAD)
continue;
if (link-pad1_sink-entity == entity)
/* do something */
by preserving the number, we keep consistency between
port1 and pad1_sink, and port0 and pad0_source.
This was generated via this script:
for i in $(find drivers/media -name '*.[ch]' -type f) $(find
drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' -type
f) ; do sed s,link-sink,link-pad1_sink,g;
s,link-source,link-pad0_source,g; $i a mv a $i; done
Signed-off-by: Mauro Carvalho Chehab mche...@osg.samsung.com
diff --git a/drivers/media/dvb-core/dvb_frontend.c
b/drivers/media/dvb-core/dvb_frontend.c
index 3c97ebdf9f2a..e673f6f7c398 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -637,7 +637,7 @@ static int dvb_enable_media_tuner(struct dvb_frontend *fe)
link = entity-links[i];
if (link-port1.type != MEDIA_GRAPH_PAD)
continue;
- if (link-sink-entity == entity) {
+ if (link-pad1_sink-entity == entity) {
found_link = link;
n_links++;
if (link-flags MEDIA_LNK_FL_ENABLED)
@@ -660,7 +660,7 @@ static int dvb_enable_media_tuner(struct dvb_frontend *fe)
return -EINVAL;
}
- source = found_link-source-entity;
+ source = found_link-pad0_source-entity;
fepriv-pipe_start_entity = source;
for (i = 0; i source-num_links; i++) {
struct media_entity *sink;
@@ -669,7 +669,7 @@ static int dvb_enable_media_tuner(struct dvb_frontend *fe)
link = source-links[i];
if (link-port1.type != MEDIA_GRAPH_PAD)
continue;
- sink = link-sink-entity;
+ sink = link-pad1_sink-entity;
if (sink == entity)
flags = MEDIA_LNK_FL_ENABLED;
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
index b4bd718ad736..2c29c4600c3a 100644
--- a/drivers/media/media-device.c
+++ b/drivers/media/media-device.c
@@ -160,13 +160,13 @@ static long __media_device_enum_links(struct media_device
*mdev,
ent_link-port1-type != MEDIA_GRAPH_PAD)
continue;
/* Ignore backlinks. */
- if (ent_link-source-entity != entity)
+ if (ent_link-pad0_source-entity != entity)
continue;
memset(link, 0, sizeof(link));
- media_device_kpad_to_upad(ent_link-source,
+ media_device_kpad_to_upad(ent_link-pad0_source,
link.source);
- media_device_kpad_to_upad(ent_link-sink,
+ media_device_kpad_to_upad(ent_link-pad1_sink,
link.sink);
link.flags = ent_link-flags;
if (copy_to_user(ulink, link, sizeof(*ulink)))
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
index fc2e4886c830..aafa1119fba7 100644
--- a/drivers/media/media-entity.c
+++ b/drivers/media/media-entity.c
@@ -125,10 +125,10 @@ media_entity_other(struct media_entity *entity, struct
media_link *link)
if (link-port0-type != MEDIA_GRAPH_PAD ||
link-port1-type != MEDIA_GRAPH_PAD)
return NULL;
- if (link-source-entity == entity)
- return link-sink-entity;
+ if (link-pad0_source-entity == entity)
+ return link-pad1_sink-entity;
else
- return link-source-entity;
+ return link-pad0_source-entity;
}
/* push an entity to traversal stack */
@@ -299,8 +299,8 @@ __must_check int media_entity_pipeline_start(struct
media_entity *entity,
if (link-port0-type != MEDIA_GRAPH_PAD)
continue;
- pad = link-sink-entity == entity
- ? link-sink : link-source;
+ pad = link-pad1_sink-entity == entity
+ ? link-pad1_sink : link-pad0_source;
/* Mark that a pad is connected by a link. */
bitmap_clear(has_no_links, pad-index, 1);
@@ -318,7 +318,7 @@ __must_check int media_entity_pipeline_start(struct
media_entity *entity,
* Link validation will only take place for
* sink ends of the link that are enabled.
*/
- if (link-sink != pad ||
+