diff mbox series

[06/11] staging: vchiq_arm: Drop vchiq_arm_init_state

Message ID 20240604172904.61613-7-wahrenst@gmx.net (mailing list archive)
State New, archived
Headers show
Series staging: vc04_services: Random cleanups | expand

Commit Message

Stefan Wahren June 4, 2024, 5:28 p.m. UTC
After removal of struct vchiq_2835_state, the init of vchiq_arm_state
can be simplified by doing it directly within vchiq_platform_init_state.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
---
 .../interface/vchiq_arm/vchiq_arm.c           | 27 +++++++------------
 1 file changed, 9 insertions(+), 18 deletions(-)

--
2.34.1

Comments

Laurent Pinchart June 5, 2024, 7:08 a.m. UTC | #1
Hi Stefan,

Thank you for the patch.

On Tue, Jun 04, 2024 at 07:28:59PM +0200, Stefan Wahren wrote:
> After removal of struct vchiq_2835_state, the init of vchiq_arm_state
> can be simplified by doing it directly within vchiq_platform_init_state.
> 
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  .../interface/vchiq_arm/vchiq_arm.c           | 27 +++++++------------
>  1 file changed, 9 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> index 98a0b2d52af5..45acca670bbd 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
> @@ -588,23 +588,6 @@ static int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state
>  	return 0;
>  }
> 
> -static void
> -vchiq_arm_init_state(struct vchiq_state *state,
> -		     struct vchiq_arm_state *arm_state)
> -{
> -	if (arm_state) {
> -		rwlock_init(&arm_state->susp_res_lock);
> -
> -		init_completion(&arm_state->ka_evt);
> -		atomic_set(&arm_state->ka_use_count, 0);
> -		atomic_set(&arm_state->ka_use_ack_count, 0);
> -		atomic_set(&arm_state->ka_release_count, 0);
> -
> -		arm_state->state = state;
> -		arm_state->first_connect = 0;
> -	}
> -}
> -
>  int
>  vchiq_platform_init_state(struct vchiq_state *state)
>  {
> @@ -614,7 +597,15 @@ vchiq_platform_init_state(struct vchiq_state *state)
>  	if (!platform_state)
>  		return -ENOMEM;
> 
> -	vchiq_arm_init_state(state, platform_state);
> +	rwlock_init(&platform_state->susp_res_lock);
> +
> +	init_completion(&platform_state->ka_evt);
> +	atomic_set(&platform_state->ka_use_count, 0);
> +	atomic_set(&platform_state->ka_use_ack_count, 0);
> +	atomic_set(&platform_state->ka_release_count, 0);
> +
> +	platform_state->state = state;
> +
>  	state->platform_state = (struct opaque_platform_state *)platform_state;
> 
>  	return 0;
diff mbox series

Patch

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 98a0b2d52af5..45acca670bbd 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -588,23 +588,6 @@  static int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state
 	return 0;
 }

-static void
-vchiq_arm_init_state(struct vchiq_state *state,
-		     struct vchiq_arm_state *arm_state)
-{
-	if (arm_state) {
-		rwlock_init(&arm_state->susp_res_lock);
-
-		init_completion(&arm_state->ka_evt);
-		atomic_set(&arm_state->ka_use_count, 0);
-		atomic_set(&arm_state->ka_use_ack_count, 0);
-		atomic_set(&arm_state->ka_release_count, 0);
-
-		arm_state->state = state;
-		arm_state->first_connect = 0;
-	}
-}
-
 int
 vchiq_platform_init_state(struct vchiq_state *state)
 {
@@ -614,7 +597,15 @@  vchiq_platform_init_state(struct vchiq_state *state)
 	if (!platform_state)
 		return -ENOMEM;

-	vchiq_arm_init_state(state, platform_state);
+	rwlock_init(&platform_state->susp_res_lock);
+
+	init_completion(&platform_state->ka_evt);
+	atomic_set(&platform_state->ka_use_count, 0);
+	atomic_set(&platform_state->ka_use_ack_count, 0);
+	atomic_set(&platform_state->ka_release_count, 0);
+
+	platform_state->state = state;
+
 	state->platform_state = (struct opaque_platform_state *)platform_state;

 	return 0;