[v12,1/9] firmware: qcom: scm: Rename scm_query_lock to scm_lock

Message ID 20240227155308.18395-2-quic_mojha@quicinc.com
State New
Headers
Series Misc SCM driver changes |

Commit Message

Mukesh Ojha Feb. 27, 2024, 3:53 p.m. UTC
  scm_query_lock is global spin lock and only used for query
purpose with trustzone and that too for one time to get the
convention of scm communication. It is possible that, it
can reused for other purpose.

Rename scm_query_lock to scm_lock.

Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
---
 drivers/firmware/qcom/qcom_scm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Bjorn Andersson March 2, 2024, 7:10 p.m. UTC | #1
On Tue, Feb 27, 2024 at 09:23:00PM +0530, Mukesh Ojha wrote:
> scm_query_lock is global spin lock and only used for query
> purpose with trustzone and that too for one time to get the
> convention of scm communication. It is possible that, it
> can reused for other purpose.
> 

This is not a good principle to follow for something as complex as
locking...

Regards,
Bjorn

> Rename scm_query_lock to scm_lock.
> 
> Signed-off-by: Mukesh Ojha <quic_mojha@quicinc.com>
> ---
>  drivers/firmware/qcom/qcom_scm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
> index 520de9b5633a..2d0ba529cf56 100644
> --- a/drivers/firmware/qcom/qcom_scm.c
> +++ b/drivers/firmware/qcom/qcom_scm.c
> @@ -193,7 +193,7 @@ static void qcom_scm_bw_disable(void)
>  }
>  
>  enum qcom_scm_convention qcom_scm_convention = SMC_CONVENTION_UNKNOWN;
> -static DEFINE_SPINLOCK(scm_query_lock);
> +static DEFINE_SPINLOCK(scm_lock);
>  
>  static enum qcom_scm_convention __get_convention(void)
>  {
> @@ -250,14 +250,14 @@ static enum qcom_scm_convention __get_convention(void)
>  
>  	probed_convention = SMC_CONVENTION_LEGACY;
>  found:
> -	spin_lock_irqsave(&scm_query_lock, flags);
> +	spin_lock_irqsave(&scm_lock, flags);
>  	if (probed_convention != qcom_scm_convention) {
>  		qcom_scm_convention = probed_convention;
>  		pr_info("qcom_scm: convention: %s%s\n",
>  			qcom_scm_convention_names[qcom_scm_convention],
>  			forced ? " (forced)" : "");
>  	}
> -	spin_unlock_irqrestore(&scm_query_lock, flags);
> +	spin_unlock_irqrestore(&scm_lock, flags);
>  
>  	return qcom_scm_convention;
>  }
> -- 
> 2.43.0.254.ga26002b62827
>
  

Patch

diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
index 520de9b5633a..2d0ba529cf56 100644
--- a/drivers/firmware/qcom/qcom_scm.c
+++ b/drivers/firmware/qcom/qcom_scm.c
@@ -193,7 +193,7 @@  static void qcom_scm_bw_disable(void)
 }
 
 enum qcom_scm_convention qcom_scm_convention = SMC_CONVENTION_UNKNOWN;
-static DEFINE_SPINLOCK(scm_query_lock);
+static DEFINE_SPINLOCK(scm_lock);
 
 static enum qcom_scm_convention __get_convention(void)
 {
@@ -250,14 +250,14 @@  static enum qcom_scm_convention __get_convention(void)
 
 	probed_convention = SMC_CONVENTION_LEGACY;
 found:
-	spin_lock_irqsave(&scm_query_lock, flags);
+	spin_lock_irqsave(&scm_lock, flags);
 	if (probed_convention != qcom_scm_convention) {
 		qcom_scm_convention = probed_convention;
 		pr_info("qcom_scm: convention: %s%s\n",
 			qcom_scm_convention_names[qcom_scm_convention],
 			forced ? " (forced)" : "");
 	}
-	spin_unlock_irqrestore(&scm_query_lock, flags);
+	spin_unlock_irqrestore(&scm_lock, flags);
 
 	return qcom_scm_convention;
 }