diff mbox series

[v2,03/15] media: ipu-bridge: Move initialization of node_names.vcm to ipu_bridge_init_swnode_names()

Message ID 20230630110643.209761-4-hdegoede@redhat.com
State Accepted
Commit 41eebd643835700982ed5b028bf42f1ff2ead61f
Headers show
Series media: ipu-bridge: Shared with atomisp, rework VCM instantiation | expand

Commit Message

Hans de Goede June 30, 2023, 11:06 a.m. UTC
Move initialization of node_names.vcm to ipu_bridge_init_swnode_names()
where it belongs.

And make the initialization of nodes[SWNODE_VCM] unconditional,
ipu_bridge_init_swnode_group() takes care of not registering it
when there is no VCM.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/media/pci/intel/ipu-bridge.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Comments

Dan Scally July 4, 2023, 11:08 a.m. UTC | #1
On 30/06/2023 13:06, Hans de Goede wrote:
> Move initialization of node_names.vcm to ipu_bridge_init_swnode_names()
> where it belongs.
>
> And make the initialization of nodes[SWNODE_VCM] unconditional,
> ipu_bridge_init_swnode_group() takes care of not registering it
> when there is no VCM.
>
> Reviewed-by: Andy Shevchenko <andy@kernel.org>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---

Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
>   drivers/media/pci/intel/ipu-bridge.c | 14 +++++++-------
>   1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
> index ef6c6cb7b51b..1c88fd925a8b 100644
> --- a/drivers/media/pci/intel/ipu-bridge.c
> +++ b/drivers/media/pci/intel/ipu-bridge.c
> @@ -201,6 +201,12 @@ static void ipu_bridge_init_swnode_names(struct ipu_sensor *sensor)
>   	snprintf(sensor->node_names.endpoint,
>   		 sizeof(sensor->node_names.endpoint),
>   		 SWNODE_GRAPH_ENDPOINT_NAME_FMT, 0); /* And endpoint 0 */
> +	if (sensor->ssdb.vcmtype) {
> +		/* append ssdb.link to distinguish nodes with same model VCM */
> +		snprintf(sensor->node_names.vcm, sizeof(sensor->node_names.vcm),
> +			 "%s-%u", ipu_vcm_types[sensor->ssdb.vcmtype - 1],
> +			 sensor->ssdb.link);
> +	}
>   }
>   
>   static void ipu_bridge_init_swnode_group(struct ipu_sensor *sensor)
> @@ -237,13 +243,7 @@ static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge,
>   						sensor->node_names.endpoint,
>   						&nodes[SWNODE_IPU_PORT],
>   						sensor->ipu_properties);
> -	if (sensor->ssdb.vcmtype) {
> -		/* append ssdb.link to distinguish VCM nodes with same HID */
> -		snprintf(sensor->node_names.vcm, sizeof(sensor->node_names.vcm),
> -			 "%s-%u", ipu_vcm_types[sensor->ssdb.vcmtype - 1],
> -			 sensor->ssdb.link);
> -		nodes[SWNODE_VCM] = NODE_VCM(sensor->node_names.vcm);
> -	}
> +	nodes[SWNODE_VCM] = NODE_VCM(sensor->node_names.vcm);
>   
>   	ipu_bridge_init_swnode_group(sensor);
>   }
diff mbox series

Patch

diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c
index ef6c6cb7b51b..1c88fd925a8b 100644
--- a/drivers/media/pci/intel/ipu-bridge.c
+++ b/drivers/media/pci/intel/ipu-bridge.c
@@ -201,6 +201,12 @@  static void ipu_bridge_init_swnode_names(struct ipu_sensor *sensor)
 	snprintf(sensor->node_names.endpoint,
 		 sizeof(sensor->node_names.endpoint),
 		 SWNODE_GRAPH_ENDPOINT_NAME_FMT, 0); /* And endpoint 0 */
+	if (sensor->ssdb.vcmtype) {
+		/* append ssdb.link to distinguish nodes with same model VCM */
+		snprintf(sensor->node_names.vcm, sizeof(sensor->node_names.vcm),
+			 "%s-%u", ipu_vcm_types[sensor->ssdb.vcmtype - 1],
+			 sensor->ssdb.link);
+	}
 }
 
 static void ipu_bridge_init_swnode_group(struct ipu_sensor *sensor)
@@ -237,13 +243,7 @@  static void ipu_bridge_create_connection_swnodes(struct ipu_bridge *bridge,
 						sensor->node_names.endpoint,
 						&nodes[SWNODE_IPU_PORT],
 						sensor->ipu_properties);
-	if (sensor->ssdb.vcmtype) {
-		/* append ssdb.link to distinguish VCM nodes with same HID */
-		snprintf(sensor->node_names.vcm, sizeof(sensor->node_names.vcm),
-			 "%s-%u", ipu_vcm_types[sensor->ssdb.vcmtype - 1],
-			 sensor->ssdb.link);
-		nodes[SWNODE_VCM] = NODE_VCM(sensor->node_names.vcm);
-	}
+	nodes[SWNODE_VCM] = NODE_VCM(sensor->node_names.vcm);
 
 	ipu_bridge_init_swnode_group(sensor);
 }