public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH -next] riscv: Use LIST_HEAD() to simplify code
@ 2024-09-04  1:33 Jinjie Ruan
  2024-09-04 18:40 ` Charlie Jenkins
  2024-09-17 16:30 ` patchwork-bot+linux-riscv
  0 siblings, 2 replies; 3+ messages in thread
From: Jinjie Ruan @ 2024-09-04  1:33 UTC (permalink / raw)
  To: paul.walmsley, palmer, aou, charlie, mcgrof, dan.carpenter, rppt,
	alexghiti, kernel, linux-riscv
  Cc: ruanjinjie

list_head can be initialized automatically with LIST_HEAD()
instead of calling INIT_LIST_HEAD().

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 arch/riscv/kernel/module.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c
index 906f9a3a5d65..1cd461f3d872 100644
--- a/arch/riscv/kernel/module.c
+++ b/arch/riscv/kernel/module.c
@@ -787,8 +787,8 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
 	int res;
 	unsigned int num_relocations = sechdrs[relsec].sh_size / sizeof(*rel);
 	struct hlist_head *relocation_hashtable;
-	struct list_head used_buckets_list;
 	unsigned int hashtable_bits;
+	LIST_HEAD(used_buckets_list);
 
 	hashtable_bits = initialize_relocation_hashtable(num_relocations,
 							 &relocation_hashtable);
@@ -796,8 +796,6 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
 	if (!relocation_hashtable)
 		return -ENOMEM;
 
-	INIT_LIST_HEAD(&used_buckets_list);
-
 	pr_debug("Applying relocate section %u to %u\n", relsec,
 	       sechdrs[relsec].sh_info);
 
-- 
2.34.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] riscv: Use LIST_HEAD() to simplify code
  2024-09-04  1:33 [PATCH -next] riscv: Use LIST_HEAD() to simplify code Jinjie Ruan
@ 2024-09-04 18:40 ` Charlie Jenkins
  2024-09-17 16:30 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 3+ messages in thread
From: Charlie Jenkins @ 2024-09-04 18:40 UTC (permalink / raw)
  To: Jinjie Ruan
  Cc: paul.walmsley, palmer, aou, mcgrof, dan.carpenter, rppt,
	alexghiti, kernel, linux-riscv

On Wed, Sep 04, 2024 at 09:33:44AM +0800, Jinjie Ruan wrote:
> list_head can be initialized automatically with LIST_HEAD()
> instead of calling INIT_LIST_HEAD().
> 
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
>  arch/riscv/kernel/module.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c
> index 906f9a3a5d65..1cd461f3d872 100644
> --- a/arch/riscv/kernel/module.c
> +++ b/arch/riscv/kernel/module.c
> @@ -787,8 +787,8 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
>  	int res;
>  	unsigned int num_relocations = sechdrs[relsec].sh_size / sizeof(*rel);
>  	struct hlist_head *relocation_hashtable;
> -	struct list_head used_buckets_list;
>  	unsigned int hashtable_bits;
> +	LIST_HEAD(used_buckets_list);
>  
>  	hashtable_bits = initialize_relocation_hashtable(num_relocations,
>  							 &relocation_hashtable);
> @@ -796,8 +796,6 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
>  	if (!relocation_hashtable)
>  		return -ENOMEM;
>  
> -	INIT_LIST_HEAD(&used_buckets_list);
> -
>  	pr_debug("Applying relocate section %u to %u\n", relsec,
>  	       sechdrs[relsec].sh_info);
>  
> -- 
> 2.34.1
> 

Looks great!

Tested-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -next] riscv: Use LIST_HEAD() to simplify code
  2024-09-04  1:33 [PATCH -next] riscv: Use LIST_HEAD() to simplify code Jinjie Ruan
  2024-09-04 18:40 ` Charlie Jenkins
@ 2024-09-17 16:30 ` patchwork-bot+linux-riscv
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+linux-riscv @ 2024-09-17 16:30 UTC (permalink / raw)
  To: Jinjie Ruan
  Cc: linux-riscv, paul.walmsley, palmer, aou, charlie, mcgrof,
	dan.carpenter, rppt, alexghiti, kernel

Hello:

This patch was applied to riscv/linux.git (for-next)
by Palmer Dabbelt <palmer@rivosinc.com>:

On Wed, 4 Sep 2024 09:33:44 +0800 you wrote:
> list_head can be initialized automatically with LIST_HEAD()
> instead of calling INIT_LIST_HEAD().
> 
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> ---
>  arch/riscv/kernel/module.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Here is the summary with links:
  - [-next] riscv: Use LIST_HEAD() to simplify code
    https://git.kernel.org/riscv/c/3cc754c237e9

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-17 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04  1:33 [PATCH -next] riscv: Use LIST_HEAD() to simplify code Jinjie Ruan
2024-09-04 18:40 ` Charlie Jenkins
2024-09-17 16:30 ` patchwork-bot+linux-riscv

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox