mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v4] LoongArch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER
@ 2023-07-17  4:08 Dong Zhihong
  2023-07-17  6:24 ` Huacai Chen
  0 siblings, 1 reply; 3+ messages in thread
From: Dong Zhihong @ 2023-07-17  4:08 UTC (permalink / raw)
  To: chenhuacai, kernel
  Cc: ardb, tangyouling, zhoubinbin, yangtiezhu, donmor3000, tglx,
	loongarch, linux-kernel

Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and
CONFIG_CMDLINE_BOOTLOADER. The touched function is bootcmdline_init()`.
There's already code handling CONFIG_CMDLINE_FORCE, which replaces
`boot_command_line` with CONFIG_CMDLINE and immediately`goto out`. It'd be
similar way to handle CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER,
so some code is added after OF_FLATTREE part to handle them.

Signed-off-by: Dong Zhihong <donmor3000@hotmail.com>
---

v4 -> v3: Make CONFIG_CMDLINE appended to the end of command line (Huacai);
	Removed unnecessary #ifdef since CONFIG_CMDLINE is always a string on
	loongarch
v3 -> v2: Reworded the commit message again to make it imperative (Ruoyao)
v2 -> v1: Reworded the commit message so it's more imperative (Markus);
	Added `goto out` to FDT part (Huacai)

 arch/loongarch/kernel/setup.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
index 78a00359bde3..3cafda1a409e 100644
--- a/arch/loongarch/kernel/setup.c
+++ b/arch/loongarch/kernel/setup.c
@@ -332,7 +332,24 @@ static void __init bootcmdline_init(char **cmdline_p)
 			strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
 
 		strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
+		goto out;
+	}
+#endif
+
+#ifdef CONFIG_CMDLINE
+	/*
+	 * If CONFIG_CMDLINE_BOOTLOADER is enabled then we use thei built-in
+	 * command line if no command line given, or we append given command
+	 * line to the built-in one if CONFIG_CMDLINE_EXTEND is enabled.
+	 */
+	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND)) {
+		strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+		strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
+		strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
 	}
+
+	if (IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0])
+		strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
 #endif
 
 out:
-- 
2.25.1


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

* Re: [PATCH v4] LoongArch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER
  2023-07-17  4:08 [PATCH v4] LoongArch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER Dong Zhihong
@ 2023-07-17  6:24 ` Huacai Chen
  2023-07-17  6:31   ` ‎ donmor
  0 siblings, 1 reply; 3+ messages in thread
From: Huacai Chen @ 2023-07-17  6:24 UTC (permalink / raw)
  To: Dong Zhihong
  Cc: kernel, ardb, tangyouling, zhoubinbin, yangtiezhu, tglx,
	loongarch, linux-kernel

On Mon, Jul 17, 2023 at 12:09 PM Dong Zhihong <donmor3000@hotmail.com> wrote:
>
> Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and
> CONFIG_CMDLINE_BOOTLOADER. The touched function is bootcmdline_init()`.
> There's already code handling CONFIG_CMDLINE_FORCE, which replaces
> `boot_command_line` with CONFIG_CMDLINE and immediately`goto out`. It'd be
> similar way to handle CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER,
> so some code is added after OF_FLATTREE part to handle them.
>
> Signed-off-by: Dong Zhihong <donmor3000@hotmail.com>
> ---
>
> v4 -> v3: Make CONFIG_CMDLINE appended to the end of command line (Huacai);
>         Removed unnecessary #ifdef since CONFIG_CMDLINE is always a string on
>         loongarch
> v3 -> v2: Reworded the commit message again to make it imperative (Ruoyao)
> v2 -> v1: Reworded the commit message so it's more imperative (Markus);
>         Added `goto out` to FDT part (Huacai)
>
>  arch/loongarch/kernel/setup.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
> index 78a00359bde3..3cafda1a409e 100644
> --- a/arch/loongarch/kernel/setup.c
> +++ b/arch/loongarch/kernel/setup.c
> @@ -332,7 +332,24 @@ static void __init bootcmdline_init(char **cmdline_p)
>                         strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
>
>                 strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
> +               goto out;
> +       }
> +#endif
> +
> +#ifdef CONFIG_CMDLINE
> +       /*
> +        * If CONFIG_CMDLINE_BOOTLOADER is enabled then we use thei built-in
> +        * command line if no command line given, or we append given command
> +        * line to the built-in one if CONFIG_CMDLINE_EXTEND is enabled.
> +        */
> +       if (IS_ENABLED(CONFIG_CMDLINE_EXTEND)) {
> +               strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> +               strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
> +               strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
>         }
> +
> +       if (IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0])
> +               strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
>  #endif
???What is the difference between V3 and V4?
And the title can be "LoongArch: Fix CONFIG_CMDLINE_EXTEND and
CONFIG_CMDLINE_BOOTLOADER handling"

Huacai

>
>  out:
> --
> 2.25.1
>

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

* Re: [PATCH v4] LoongArch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER
  2023-07-17  6:24 ` Huacai Chen
@ 2023-07-17  6:31   ` ‎ donmor
  0 siblings, 0 replies; 3+ messages in thread
From: ‎ donmor @ 2023-07-17  6:31 UTC (permalink / raw)
  To: chenhuacai
  Cc: loongarch, kernel, yangtiezhu, zhoubinbin, linux-kernel, tglx,
	ardb, tangyouling

在 2023-07-17星期一的 14:24 +0800,Huacai Chen写道:
> On Mon, Jul 17, 2023 at 12:09 PM Dong Zhihong <donmor3000@hotmail.com> wrote:
> > Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and
> > CONFIG_CMDLINE_BOOTLOADER. The touched function is bootcmdline_init()`.
> > There's already code handling CONFIG_CMDLINE_FORCE, which replaces
> > `boot_command_line` with CONFIG_CMDLINE and immediately`goto out`. It'd be
> > similar way to handle CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER,
> > so some code is added after OF_FLATTREE part to handle them.
> > 
> > Signed-off-by: Dong Zhihong <donmor3000@hotmail.com>
> > ---
> > 
> > v4 -> v3: Make CONFIG_CMDLINE appended to the end of command line (Huacai);
> >         Removed unnecessary #ifdef since CONFIG_CMDLINE is always a string on
> >         loongarch
> > v3 -> v2: Reworded the commit message again to make it imperative (Ruoyao)
> > v2 -> v1: Reworded the commit message so it's more imperative (Markus);
> >         Added `goto out` to FDT part (Huacai)
> > 
> >  arch/loongarch/kernel/setup.c | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> > 
> > diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c
> > index 78a00359bde3..3cafda1a409e 100644
> > --- a/arch/loongarch/kernel/setup.c
> > +++ b/arch/loongarch/kernel/setup.c
> > @@ -332,7 +332,24 @@ static void __init bootcmdline_init(char **cmdline_p)
> >                         strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
> > 
> >                 strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
> > +               goto out;
> > +       }
> > +#endif
> > +
> > +#ifdef CONFIG_CMDLINE
> > +       /*
> > +        * If CONFIG_CMDLINE_BOOTLOADER is enabled then we use thei built-in
> > +        * command line if no command line given, or we append given command
> > +        * line to the built-in one if CONFIG_CMDLINE_EXTEND is enabled.
> > +        */
> > +       if (IS_ENABLED(CONFIG_CMDLINE_EXTEND)) {
> > +               strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> > +               strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
> > +               strlcat(boot_command_line, init_command_line, COMMAND_LINE_SIZE);
> >         }
> > +
> > +       if (IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0])
> > +               strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
> >  #endif
> ???What is the difference between V3 and V4?
> And the title can be "LoongArch: Fix CONFIG_CMDLINE_EXTEND and
> CONFIG_CMDLINE_BOOTLOADER handling"
> 
> Huacai
> 
> >  out:
> > --
> > 2.25.1
> > 

Looks like I missed -a on commit... I'll resend it ASAP.

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

end of thread, other threads:[~2023-07-17  6:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17  4:08 [PATCH v4] LoongArch: Make CONFIG_CMDLINE work with CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER Dong Zhihong
2023-07-17  6:24 ` Huacai Chen
2023-07-17  6:31   ` ‎ donmor

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

all inboxes | Powered by JetHome®