diff mbox series

lib: sbi: dbtr: Delete redundant `ulong`

Message ID 20240814031749.2741251-1-runmin.zhang@ingenic.com
State Superseded
Headers show
Series lib: sbi: dbtr: Delete redundant `ulong` | expand

Commit Message

Zhang Runmin Aug. 14, 2024, 3:17 a.m. UTC
From: Zhang RunMin <runmin.zhang@ingenic.com>

In `csr_read_allowed` and `csr_write_allowed` macros, has already
converted second param to `ulong`.
---
 lib/sbi/sbi_dbtr.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Comments

Xiang W Aug. 14, 2024, 3:57 a.m. UTC | #1
在 2024-08-14星期三的 11:17 +0800,Zhang Runmin写道:
> From: Zhang RunMin <runmin.zhang@ingenic.com>
> 
> In `csr_read_allowed` and `csr_write_allowed` macros, has already
> converted second param to `ulong`.
Missing SoB

Similar problems also exist in the following files:
lib/sbi/sbi_hart.c
lib/utils/irqchip/imsic.c

Regards,
Xiang W
> ---
>  lib/sbi/sbi_dbtr.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/sbi/sbi_dbtr.c b/lib/sbi/sbi_dbtr.c
> index 27a8b91..60c37b4 100644
> --- a/lib/sbi/sbi_dbtr.c
> +++ b/lib/sbi/sbi_dbtr.c
> @@ -167,11 +167,12 @@ int sbi_dbtr_init(struct sbi_scratch *scratch, bool coldboot)
>  		goto _probed;
>  
>  	for (i = 0; i < RV_MAX_TRIGGERS; i++) {
> -		csr_write_allowed(CSR_TSELECT, (ulong)&trap, i);
> +		// CSR_TESLECT 0x7a0
> +		csr_write_allowed(CSR_TSELECT, &trap, i);
>  		if (trap.cause)
>  			break;
>  
> -		val = csr_read_allowed(CSR_TSELECT, (ulong)&trap);
> +		val = csr_read_allowed(CSR_TSELECT, &trap);
>  		if (trap.cause)
>  			break;
>  
> @@ -182,7 +183,7 @@ int sbi_dbtr_init(struct sbi_scratch *scratch, bool coldboot)
>  		if (val != i)
>  			break;
>  
> -		val = csr_read_allowed(CSR_TINFO, (ulong)&trap);
> +		val = csr_read_allowed(CSR_TINFO, &trap);
>  		if (trap.cause) {
>  			/*
>  			 * If reading tinfo caused an exception, the
> @@ -190,7 +191,7 @@ int sbi_dbtr_init(struct sbi_scratch *scratch, bool coldboot)
>  			 * type.
>  			 */
>  			tdata1 = csr_read_allowed(CSR_TDATA1,
> -						  (ulong)&trap);
> +						  &trap);
>  			if (trap.cause)
>  				break;
>  
> -- 
> 2.25.1
> 
>
diff mbox series

Patch

diff --git a/lib/sbi/sbi_dbtr.c b/lib/sbi/sbi_dbtr.c
index 27a8b91..60c37b4 100644
--- a/lib/sbi/sbi_dbtr.c
+++ b/lib/sbi/sbi_dbtr.c
@@ -167,11 +167,12 @@  int sbi_dbtr_init(struct sbi_scratch *scratch, bool coldboot)
 		goto _probed;
 
 	for (i = 0; i < RV_MAX_TRIGGERS; i++) {
-		csr_write_allowed(CSR_TSELECT, (ulong)&trap, i);
+		// CSR_TESLECT 0x7a0
+		csr_write_allowed(CSR_TSELECT, &trap, i);
 		if (trap.cause)
 			break;
 
-		val = csr_read_allowed(CSR_TSELECT, (ulong)&trap);
+		val = csr_read_allowed(CSR_TSELECT, &trap);
 		if (trap.cause)
 			break;
 
@@ -182,7 +183,7 @@  int sbi_dbtr_init(struct sbi_scratch *scratch, bool coldboot)
 		if (val != i)
 			break;
 
-		val = csr_read_allowed(CSR_TINFO, (ulong)&trap);
+		val = csr_read_allowed(CSR_TINFO, &trap);
 		if (trap.cause) {
 			/*
 			 * If reading tinfo caused an exception, the
@@ -190,7 +191,7 @@  int sbi_dbtr_init(struct sbi_scratch *scratch, bool coldboot)
 			 * type.
 			 */
 			tdata1 = csr_read_allowed(CSR_TDATA1,
-						  (ulong)&trap);
+						  &trap);
 			if (trap.cause)
 				break;