diff mbox series

[v2,14/14] media: staging: rkisp1: params: no need to lock default config

Message ID 20200815103734.31153-15-dafna.hirschfeld@collabora.com (mailing list archive)
State New, archived
Headers show
Series media: staging: rkisp1: various bug fixes | expand

Commit Message

Dafna Hirschfeld Aug. 15, 2020, 10:37 a.m. UTC
In the function 'rkisp1_params_config_parameter' the lock
is taken while applying the default config. But the lock
only needs to protect the buffers list and the 'is_streaming'
field, so move the locking to lock only what is needed.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
---
 drivers/staging/media/rkisp1/rkisp1-params.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Helen Mae Koike Fornazier Aug. 17, 2020, 9:48 p.m. UTC | #1
On 8/15/20 7:37 AM, Dafna Hirschfeld wrote:
> In the function 'rkisp1_params_config_parameter' the lock
> is taken while applying the default config. But the lock
> only needs to protect the buffers list and the 'is_streaming'
> field, so move the locking to lock only what is needed.
> 
> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>

Acked-by: Helen Koike <helen.koike@collabora.com>

Thanks
Helen

> ---
>  drivers/staging/media/rkisp1/rkisp1-params.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c
> index 7d5c21fa630e..6c71da311294 100644
> --- a/drivers/staging/media/rkisp1/rkisp1-params.c
> +++ b/drivers/staging/media/rkisp1/rkisp1-params.c
> @@ -1283,8 +1283,6 @@ static void rkisp1_params_config_parameter(struct rkisp1_params *params)
>  {
>  	struct rkisp1_cif_isp_hst_config hst = rkisp1_hst_params_default_config;
>  
> -	spin_lock(&params->config_lock);
> -
>  	rkisp1_awb_meas_config(params, &rkisp1_awb_params_default_config);
>  	rkisp1_awb_meas_enable(params, &rkisp1_awb_params_default_config,
>  			       true);
> @@ -1309,6 +1307,8 @@ static void rkisp1_params_config_parameter(struct rkisp1_params *params)
>  	else
>  		rkisp1_csm_config(params, false);
>  
> +	spin_lock(&params->config_lock);
> +
>  	/* apply the first buffer if there is one already */
>  	if (params->is_streaming)
>  		rkisp1_params_apply_params_cfg(params, 0);
>
diff mbox series

Patch

diff --git a/drivers/staging/media/rkisp1/rkisp1-params.c b/drivers/staging/media/rkisp1/rkisp1-params.c
index 7d5c21fa630e..6c71da311294 100644
--- a/drivers/staging/media/rkisp1/rkisp1-params.c
+++ b/drivers/staging/media/rkisp1/rkisp1-params.c
@@ -1283,8 +1283,6 @@  static void rkisp1_params_config_parameter(struct rkisp1_params *params)
 {
 	struct rkisp1_cif_isp_hst_config hst = rkisp1_hst_params_default_config;
 
-	spin_lock(&params->config_lock);
-
 	rkisp1_awb_meas_config(params, &rkisp1_awb_params_default_config);
 	rkisp1_awb_meas_enable(params, &rkisp1_awb_params_default_config,
 			       true);
@@ -1309,6 +1307,8 @@  static void rkisp1_params_config_parameter(struct rkisp1_params *params)
 	else
 		rkisp1_csm_config(params, false);
 
+	spin_lock(&params->config_lock);
+
 	/* apply the first buffer if there is one already */
 	if (params->is_streaming)
 		rkisp1_params_apply_params_cfg(params, 0);