Hi Kaaira, On 19/08/2020 19:04, Kaaira Gupta wrote: > Move the function vimc_get_source_entity() to vimc-common.c to make it > reusable. > > Signed-off-by: Kaaira Gupta <kgupta@xxxxxxxxxxxxx> Reviewed-by: Kieran Bingham <kieran.bingham@xxxxxxxxxxxxxxxx> > --- > drivers/media/test-drivers/vimc/vimc-common.c | 14 +++++++++++ > drivers/media/test-drivers/vimc/vimc-common.h | 12 ++++++++++ > .../media/test-drivers/vimc/vimc-streamer.c | 24 ------------------- > 3 files changed, 26 insertions(+), 24 deletions(-) > > diff --git a/drivers/media/test-drivers/vimc/vimc-common.c b/drivers/media/test-drivers/vimc/vimc-common.c > index 0d97b25ce21e..91c8992bb391 100644 > --- a/drivers/media/test-drivers/vimc/vimc-common.c > +++ b/drivers/media/test-drivers/vimc/vimc-common.c > @@ -417,3 +417,17 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved, > media_entity_cleanup(&sd->entity); > return ret; > } > + > +struct media_entity *vimc_get_source_entity(struct media_entity *ent) > +{ > + struct media_pad *pad; > + int i; > + > + for (i = 0; i < ent->num_pads; i++) { > + if (ent->pads[i].flags & MEDIA_PAD_FL_SOURCE) > + continue; > + pad = media_entity_remote_pad(&ent->pads[i]); > + return pad ? pad->entity : NULL; > + } > + return NULL; > +} > diff --git a/drivers/media/test-drivers/vimc/vimc-common.h b/drivers/media/test-drivers/vimc/vimc-common.h > index a289434e75ba..4c580d854007 100644 > --- a/drivers/media/test-drivers/vimc/vimc-common.h > +++ b/drivers/media/test-drivers/vimc/vimc-common.h > @@ -230,4 +230,16 @@ int vimc_ent_sd_register(struct vimc_ent_device *ved, > */ > int vimc_vdev_link_validate(struct media_link *link); > > +/** > + * vimc_get_source_entity - get the entity connected with the first sink pad > + * > + * @ent: reference media_entity > + * > + * Helper function that returns the media entity containing the source pad > + * linked with the first sink pad from the given media entity pad list. > + * > + * Return: The source pad or NULL, if it wasn't found. > + */ > +struct media_entity *vimc_get_source_entity(struct media_entity *ent); > + > #endif > diff --git a/drivers/media/test-drivers/vimc/vimc-streamer.c b/drivers/media/test-drivers/vimc/vimc-streamer.c > index 451a32c0d034..4f8384246042 100644 > --- a/drivers/media/test-drivers/vimc/vimc-streamer.c > +++ b/drivers/media/test-drivers/vimc/vimc-streamer.c > @@ -12,30 +12,6 @@ > > #include "vimc-streamer.h" > > -/** > - * vimc_get_source_entity - get the entity connected with the first sink pad > - * > - * @ent: reference media_entity > - * > - * Helper function that returns the media entity containing the source pad > - * linked with the first sink pad from the given media entity pad list. > - * > - * Return: The source pad or NULL, if it wasn't found. > - */ > -static struct media_entity *vimc_get_source_entity(struct media_entity *ent) > -{ > - struct media_pad *pad; > - int i; > - > - for (i = 0; i < ent->num_pads; i++) { > - if (ent->pads[i].flags & MEDIA_PAD_FL_SOURCE) > - continue; > - pad = media_entity_remote_pad(&ent->pads[i]); > - return pad ? pad->entity : NULL; > - } > - return NULL; > -} > - > /** > * vimc_streamer_pipeline_terminate - Disable stream in all ved in stream > * > -- Regards -- Kieran