[PATCH] LoongArch: use assign_bit() where applicable

Peng Fan (OSS) posted 1 patch 4 days, 18 hours ago
arch/loongarch/kernel/env.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
[PATCH] LoongArch: use assign_bit() where applicable
Posted by Peng Fan (OSS) 4 days, 18 hours ago
From: Peng Fan <peng.fan@nxp.com>

Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 arch/loongarch/kernel/env.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/arch/loongarch/kernel/env.c b/arch/loongarch/kernel/env.c
index 652456768b55..c529a14deb18 100644
--- a/arch/loongarch/kernel/env.c
+++ b/arch/loongarch/kernel/env.c
@@ -25,10 +25,7 @@ void __init init_environ(void)
 	int efi_boot = fw_arg0;
 	char *cmdline = early_memremap_ro(fw_arg1, COMMAND_LINE_SIZE);
 
-	if (efi_boot)
-		set_bit(EFI_BOOT, &efi.flags);
-	else
-		clear_bit(EFI_BOOT, &efi.flags);
+	assign_bit(EFI_BOOT, &efi.flags, efi_boot);
 
 	strscpy(boot_command_line, cmdline, COMMAND_LINE_SIZE);
 	strscpy(init_command_line, cmdline, COMMAND_LINE_SIZE);
-- 
2.51.0
Re: [PATCH] LoongArch: use assign_bit() where applicable
Posted by Huacai Chen 3 days, 6 hours ago
Applied, thanks.

Huacai

On Sun, Sep 20, 2026 at 10:29 AM Peng Fan (OSS) <peng.fan@oss.nxp.com> wrote:
>
> From: Peng Fan <peng.fan@nxp.com>
>
> Convert open-coded if/else with set_bit/clear_bit to the assign_bit API.
>
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  arch/loongarch/kernel/env.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/loongarch/kernel/env.c b/arch/loongarch/kernel/env.c
> index 652456768b55..c529a14deb18 100644
> --- a/arch/loongarch/kernel/env.c
> +++ b/arch/loongarch/kernel/env.c
> @@ -25,10 +25,7 @@ void __init init_environ(void)
>         int efi_boot = fw_arg0;
>         char *cmdline = early_memremap_ro(fw_arg1, COMMAND_LINE_SIZE);
>
> -       if (efi_boot)
> -               set_bit(EFI_BOOT, &efi.flags);
> -       else
> -               clear_bit(EFI_BOOT, &efi.flags);
> +       assign_bit(EFI_BOOT, &efi.flags, efi_boot);
>
>         strscpy(boot_command_line, cmdline, COMMAND_LINE_SIZE);
>         strscpy(init_command_line, cmdline, COMMAND_LINE_SIZE);
> --
> 2.51.0
>