Commit 9d0c23bf authored by Daniel Scally's avatar Daniel Scally Committed by Mauro Carvalho Chehab

media: entity: Add link_type_name() helper

Now we have three types of media link, printing the right name during
debug output is slightly more complicated. Add a helper function to
make it easier.
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarDaniel Scally <djrscally@gmail.com>
Reviewed-by: default avatarJean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 4e4dab4b
...@@ -44,6 +44,20 @@ static inline const char *intf_type(struct media_interface *intf) ...@@ -44,6 +44,20 @@ static inline const char *intf_type(struct media_interface *intf)
} }
}; };
static inline const char *link_type_name(struct media_link *link)
{
switch (link->flags & MEDIA_LNK_FL_LINK_TYPE) {
case MEDIA_LNK_FL_DATA_LINK:
return "data";
case MEDIA_LNK_FL_INTERFACE_LINK:
return "interface";
case MEDIA_LNK_FL_ANCILLARY_LINK:
return "ancillary";
default:
return "unknown";
}
}
__must_check int __media_entity_enum_init(struct media_entity_enum *ent_enum, __must_check int __media_entity_enum_init(struct media_entity_enum *ent_enum,
int idx_max) int idx_max)
{ {
...@@ -89,9 +103,7 @@ static void dev_dbg_obj(const char *event_name, struct media_gobj *gobj) ...@@ -89,9 +103,7 @@ static void dev_dbg_obj(const char *event_name, struct media_gobj *gobj)
dev_dbg(gobj->mdev->dev, dev_dbg(gobj->mdev->dev,
"%s id %u: %s link id %u ==> id %u\n", "%s id %u: %s link id %u ==> id %u\n",
event_name, media_id(gobj), event_name, media_id(gobj), link_type_name(link),
media_type(link->gobj0) == MEDIA_GRAPH_PAD ?
"data" : "interface",
media_id(link->gobj0), media_id(link->gobj0),
media_id(link->gobj1)); media_id(link->gobj1));
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment