[libcamera-devel] libcamera: pipeline: simple: Rename Entity::link to sourceLink
diff mbox series

Message ID 20211223022425.11927-1-laurent.pinchart@ideasonboard.com
State Accepted
Commit 22b61a4f3054089090f62cb8acaa6b96aae79903
Headers show
Series
  • [libcamera-devel] libcamera: pipeline: simple: Rename Entity::link to sourceLink
Related show

Commit Message

Laurent Pinchart Dec. 23, 2021, 2:24 a.m. UTC
The Entity::link member has an ambiguous name. Rename it to sourceLink
to clarify that it stores the link on the source pad.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/pipeline/simple/simple.cpp | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)


base-commit: 8ff5a8d548eee7c2cb14b355867debdb29e75419

Comments

Kieran Bingham Dec. 23, 2021, 1:40 p.m. UTC | #1
Quoting Laurent Pinchart (2021-12-23 02:24:25)
> The Entity::link member has an ambiguous name. Rename it to sourceLink
> to clarify that it stores the link on the source pad.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/libcamera/pipeline/simple/simple.cpp | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
> index 8aa36306952b..ece821bfe978 100644
> --- a/src/libcamera/pipeline/simple/simple.cpp
> +++ b/src/libcamera/pipeline/simple/simple.cpp
> @@ -202,10 +202,10 @@ public:
>                  */
>                 const MediaPad *source;
>                 /*
> -                * The link to the downstream entity, null for the video node at
> -                * the end of the pipeline.
> +                * The link on the source pad, to the downstream entity, null
> +                * for the video node at the end of the pipeline.
>                  */
> -               MediaLink *link;
> +               MediaLink *sourceLink;
>         };
>  
>         struct Configuration {
> @@ -537,13 +537,13 @@ int SimpleCameraData::setupLinks()
>          * want to enable) before enabling the pipeline link.
>          */
>         for (SimpleCameraData::Entity &e : entities_) {
> -               if (!e.link)
> +               if (!e.sourceLink)
>                         break;
>  
> -               MediaEntity *remote = e.link->sink()->entity();
> +               MediaEntity *remote = e.sourceLink->sink()->entity();
>                 for (MediaPad *pad : remote->pads()) {
>                         for (MediaLink *link : pad->links()) {
> -                               if (link == e.link)
> +                               if (link == e.sourceLink)
>                                         continue;
>  
>                                 if ((link->flags() & MEDIA_LNK_FL_ENABLED) &&
> @@ -555,8 +555,8 @@ int SimpleCameraData::setupLinks()
>                         }
>                 }
>  
> -               if (!(e.link->flags() & MEDIA_LNK_FL_ENABLED)) {
> -                       ret = e.link->setEnabled(true);
> +               if (!(e.sourceLink->flags() & MEDIA_LNK_FL_ENABLED)) {
> +                       ret = e.sourceLink->setEnabled(true);
>                         if (ret < 0)
>                                 return ret;
>                 }
> @@ -580,10 +580,10 @@ int SimpleCameraData::setupFormats(V4L2SubdeviceFormat *format,
>                 return ret;
>  
>         for (const Entity &e : entities_) {
> -               if (!e.link)
> +               if (!e.sourceLink)
>                         break;
>  
> -               MediaLink *link = e.link;
> +               MediaLink *link = e.sourceLink;
>                 MediaPad *source = link->source();
>                 MediaPad *sink = link->sink();
>  
> 
> base-commit: 8ff5a8d548eee7c2cb14b355867debdb29e75419
> -- 
> Regards,
> 
> Laurent Pinchart
>
Jacopo Mondi Dec. 29, 2021, 6:54 p.m. UTC | #2
Hi Laurent

On Thu, Dec 23, 2021 at 04:24:25AM +0200, Laurent Pinchart wrote:
> The Entity::link member has an ambiguous name. Rename it to sourceLink
> to clarify that it stores the link on the source pad.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Looks reasonable!
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> ---
>  src/libcamera/pipeline/simple/simple.cpp | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
> index 8aa36306952b..ece821bfe978 100644
> --- a/src/libcamera/pipeline/simple/simple.cpp
> +++ b/src/libcamera/pipeline/simple/simple.cpp
> @@ -202,10 +202,10 @@ public:
>  		 */
>  		const MediaPad *source;
>  		/*
> -		 * The link to the downstream entity, null for the video node at
> -		 * the end of the pipeline.
> +		 * The link on the source pad, to the downstream entity, null
> +		 * for the video node at the end of the pipeline.
>  		 */
> -		MediaLink *link;
> +		MediaLink *sourceLink;
>  	};
>
>  	struct Configuration {
> @@ -537,13 +537,13 @@ int SimpleCameraData::setupLinks()
>  	 * want to enable) before enabling the pipeline link.
>  	 */
>  	for (SimpleCameraData::Entity &e : entities_) {
> -		if (!e.link)
> +		if (!e.sourceLink)
>  			break;
>
> -		MediaEntity *remote = e.link->sink()->entity();
> +		MediaEntity *remote = e.sourceLink->sink()->entity();
>  		for (MediaPad *pad : remote->pads()) {
>  			for (MediaLink *link : pad->links()) {
> -				if (link == e.link)
> +				if (link == e.sourceLink)
>  					continue;
>
>  				if ((link->flags() & MEDIA_LNK_FL_ENABLED) &&
> @@ -555,8 +555,8 @@ int SimpleCameraData::setupLinks()
>  			}
>  		}
>
> -		if (!(e.link->flags() & MEDIA_LNK_FL_ENABLED)) {
> -			ret = e.link->setEnabled(true);
> +		if (!(e.sourceLink->flags() & MEDIA_LNK_FL_ENABLED)) {
> +			ret = e.sourceLink->setEnabled(true);
>  			if (ret < 0)
>  				return ret;
>  		}
> @@ -580,10 +580,10 @@ int SimpleCameraData::setupFormats(V4L2SubdeviceFormat *format,
>  		return ret;
>
>  	for (const Entity &e : entities_) {
> -		if (!e.link)
> +		if (!e.sourceLink)
>  			break;
>
> -		MediaLink *link = e.link;
> +		MediaLink *link = e.sourceLink;
>  		MediaPad *source = link->source();
>  		MediaPad *sink = link->sink();
>
>
> base-commit: 8ff5a8d548eee7c2cb14b355867debdb29e75419
> --
> Regards,
>
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp
index 8aa36306952b..ece821bfe978 100644
--- a/src/libcamera/pipeline/simple/simple.cpp
+++ b/src/libcamera/pipeline/simple/simple.cpp
@@ -202,10 +202,10 @@  public:
 		 */
 		const MediaPad *source;
 		/*
-		 * The link to the downstream entity, null for the video node at
-		 * the end of the pipeline.
+		 * The link on the source pad, to the downstream entity, null
+		 * for the video node at the end of the pipeline.
 		 */
-		MediaLink *link;
+		MediaLink *sourceLink;
 	};
 
 	struct Configuration {
@@ -537,13 +537,13 @@  int SimpleCameraData::setupLinks()
 	 * want to enable) before enabling the pipeline link.
 	 */
 	for (SimpleCameraData::Entity &e : entities_) {
-		if (!e.link)
+		if (!e.sourceLink)
 			break;
 
-		MediaEntity *remote = e.link->sink()->entity();
+		MediaEntity *remote = e.sourceLink->sink()->entity();
 		for (MediaPad *pad : remote->pads()) {
 			for (MediaLink *link : pad->links()) {
-				if (link == e.link)
+				if (link == e.sourceLink)
 					continue;
 
 				if ((link->flags() & MEDIA_LNK_FL_ENABLED) &&
@@ -555,8 +555,8 @@  int SimpleCameraData::setupLinks()
 			}
 		}
 
-		if (!(e.link->flags() & MEDIA_LNK_FL_ENABLED)) {
-			ret = e.link->setEnabled(true);
+		if (!(e.sourceLink->flags() & MEDIA_LNK_FL_ENABLED)) {
+			ret = e.sourceLink->setEnabled(true);
 			if (ret < 0)
 				return ret;
 		}
@@ -580,10 +580,10 @@  int SimpleCameraData::setupFormats(V4L2SubdeviceFormat *format,
 		return ret;
 
 	for (const Entity &e : entities_) {
-		if (!e.link)
+		if (!e.sourceLink)
 			break;
 
-		MediaLink *link = e.link;
+		MediaLink *link = e.sourceLink;
 		MediaPad *source = link->source();
 		MediaPad *sink = link->sink();