Message ID | 20211213232849.40071-3-djrscally@gmail.com |
---|---|
State | Not Applicable |
Headers | show |
Series |
|
Related | show |
Hi Daniel, Thank you for the patch. On Mon, Dec 13, 2021 at 11:28:46PM +0000, Daniel Scally wrote: > 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. > > Signed-off-by: Daniel Scally <djrscally@gmail.com> > --- > Changes since the rfc: > > - new patch > > drivers/media/mc/mc-entity.c | 18 +++++++++++++++--- > 1 file changed, 15 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c > index f40f41977142..d79eb88bc167 100644 > --- a/drivers/media/mc/mc-entity.c > +++ b/drivers/media/mc/mc-entity.c > @@ -60,6 +60,20 @@ static inline const char *intf_type(struct media_interface *intf) > } > }; > > +static inline const char *link_type(struct media_link *link) This could be named link_type_name() to avoid confusion with a function that would return the link type. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > +{ > + 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, > int idx_max) > { > @@ -107,9 +121,7 @@ static void dev_dbg_obj(const char *event_name, struct media_gobj *gobj) > > dev_dbg(gobj->mdev->dev, > "%s id %u: %s link id %u ==> id %u\n", > - event_name, media_id(gobj), > - media_type(link->gobj0) == MEDIA_GRAPH_PAD ? > - "data" : "interface", > + event_name, media_id(gobj), link_type(link), > media_id(link->gobj0), > media_id(link->gobj1)); > break;
Hi Laurent On 14/12/2021 21:54, Laurent Pinchart wrote: > Hi Daniel, > > Thank you for the patch. > > On Mon, Dec 13, 2021 at 11:28:46PM +0000, Daniel Scally wrote: >> 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. >> >> Signed-off-by: Daniel Scally <djrscally@gmail.com> >> --- >> Changes since the rfc: >> >> - new patch >> >> drivers/media/mc/mc-entity.c | 18 +++++++++++++++--- >> 1 file changed, 15 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c >> index f40f41977142..d79eb88bc167 100644 >> --- a/drivers/media/mc/mc-entity.c >> +++ b/drivers/media/mc/mc-entity.c >> @@ -60,6 +60,20 @@ static inline const char *intf_type(struct media_interface *intf) >> } >> }; >> >> +static inline const char *link_type(struct media_link *link) > This could be named link_type_name() to avoid confusion with a function > that would return the link type. Probably yeah - I'll do that in v2 > Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Thank you > >> +{ >> + 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, >> int idx_max) >> { >> @@ -107,9 +121,7 @@ static void dev_dbg_obj(const char *event_name, struct media_gobj *gobj) >> >> dev_dbg(gobj->mdev->dev, >> "%s id %u: %s link id %u ==> id %u\n", >> - event_name, media_id(gobj), >> - media_type(link->gobj0) == MEDIA_GRAPH_PAD ? >> - "data" : "interface", >> + event_name, media_id(gobj), link_type(link), >> media_id(link->gobj0), >> media_id(link->gobj1)); >> break;
diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index f40f41977142..d79eb88bc167 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -60,6 +60,20 @@ static inline const char *intf_type(struct media_interface *intf) } }; +static inline const char *link_type(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, int idx_max) { @@ -107,9 +121,7 @@ static void dev_dbg_obj(const char *event_name, struct media_gobj *gobj) dev_dbg(gobj->mdev->dev, "%s id %u: %s link id %u ==> id %u\n", - event_name, media_id(gobj), - media_type(link->gobj0) == MEDIA_GRAPH_PAD ? - "data" : "interface", + event_name, media_id(gobj), link_type(link), media_id(link->gobj0), media_id(link->gobj1)); break;
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. Signed-off-by: Daniel Scally <djrscally@gmail.com> --- Changes since the rfc: - new patch drivers/media/mc/mc-entity.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)