[PATCH 2/5] lib: sbi: Remove unnecessary sbi_dbtr_shmem_disabled

Xiang W wxjstz at 126.com
Tue Apr 23 08:00:31 PDT 2024


在 2024-04-23星期二的 22:51 +0800,Xiang W写道:
> The code of hart_shmem_base is similar to sbi_dbtr_shmem_disabled.
> When hart_shmem_base is used, sbi_dbtr_shmem_disabled can be
> removed.
> 
> Signed-off-by: Xiang W <wxjstz at 126.com>
> ---
>  lib/sbi/sbi_dbtr.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/lib/sbi/sbi_dbtr.c b/lib/sbi/sbi_dbtr.c
> index 5b07285..478852e 100644
> --- a/lib/sbi/sbi_dbtr.c
> +++ b/lib/sbi/sbi_dbtr.c
> @@ -537,10 +537,9 @@ int sbi_dbtr_read_trig(unsigned long smode,
>  	    trig_idx_base + trig_count >= hs->total_trigs)
>  		return SBI_ERR_INVALID_PARAM;
>  
> -	if (sbi_dbtr_shmem_disabled())
> -		return SBI_ERR_NO_SHMEM;
> -
>  	shmem_base = hart_shmem_base();
> +	if (shmem_base)
Sorry for the mistake here, new patch will be sent

Apology,
Xiang W
> +		return SBI_ERR_NO_SHMEM;
>  
>  	for_each_trig_entry(shmem_base, trig_count, typeof(*entry), entry) {
>  		sbi_hart_map_saddr((unsigned long)entry, sizeof(*entry));
> @@ -567,10 +566,10 @@ int sbi_dbtr_install_trig(unsigned long smode,
>  	struct sbi_dbtr_trigger *trig;
>  	struct sbi_dbtr_hart_triggers_state *hs = NULL;
>  
> -	if (sbi_dbtr_shmem_disabled())
> +	shmem_base = hart_shmem_base();
> +	if (shmem_base)
>  		return SBI_ERR_NO_SHMEM;
>  
> -	shmem_base = hart_shmem_base();
>  	hs = dbtr_thishart_state_ptr();
>  
>  	/* Check requested triggers configuration */
> @@ -679,10 +678,10 @@ int sbi_dbtr_update_trig(unsigned long smode,
>  	void *shmem_base = NULL;
>  	struct sbi_dbtr_hart_triggers_state *hs = NULL;
>  
> -	if (sbi_dbtr_shmem_disabled())
> +	shmem_base = hart_shmem_base();
> +	if (shmem_base)
>  		return SBI_ERR_NO_SHMEM;
>  
> -	shmem_base = hart_shmem_base();
>  	hs = dbtr_thishart_state_ptr();
>  	if (!hs)
>  		return SBI_ERR_FAILED;




More information about the opensbi mailing list