Message ID | 20230718153348.3340811-1-chenhuacai@loongson.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1853852vqt; Tue, 18 Jul 2023 09:09:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlH3qweDYgpaR2xwIgwOvkSbQIJ+eC6EcWDaHnq1PGFf8YYh7JJexlIlJ6SjKRlku1VAKFgC X-Received: by 2002:a05:6402:1d4e:b0:51e:2e6f:70fb with SMTP id dz14-20020a0564021d4e00b0051e2e6f70fbmr526525edb.6.1689696597276; Tue, 18 Jul 2023 09:09:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689696597; cv=none; d=google.com; s=arc-20160816; b=pOqKqsHEglm5SS3Qh9du4aiGiaAUQMcQLzT5lWR0+m1yTsSPvJKTJJ2drU8EikjlnN tN2yHyz6XOoWocFGuFh9CY5sbgWIE7pAzBZ0pks0HsDO0/1tbpOSS9K3PvBQA6O7He2O jvU8fBYkq34vvHK7ZfTFtJ/3vSOo4ORtSJs2ejGLme6rehe9tBKL2M5Au5chHz9KgWF6 F+bhJYKBco7OpYl4VcgJfG9YceEdXRPOx4zWBS2euGfVojrzKy0c8GxEB1d7sJVIzpvO K7YPlswOLRQtKbbOHKDJ5foEiUx9cvV5tRMlkpsQn5J12XGeyA5uTmo5y0pvokZXbeH3 GIlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=hqFkTENYgRTyYs2/nWbTX9AMhY2wDPAfYh7jwpw76bM=; fh=dkZMXsO62OknhhapWL5tvFwtPkmFIjMDSfVSNsyCXhc=; b=drwSQ3Tn0M4vxH6hsVrK7PBNKuYgexrpgVzutXxHrLIElVTWhrSOJ27T36TIOLWBMI gR6Mx2ADbqN6d2CX59LylixAG5F/XsxTFGt5MB7AOr3d4DEkfhoZWlsTN6h/GoQEIrt/ tz4uApD1u6+7fGjOIkz+jN7Tscu2apBAInxDSI+zJGMRCqREBOUsIONra1nYSU9jCyo3 OtONDDXMh1QWnZqW3YXy0flUY5U4kZMjZ50YUrSd3QO/K4fBVJB+i+oXBjzTHaWvnIe7 q/iXdgmLXcHJyY+VyIcM7VzKT1br/7svHtON+EqtVlf/LiQGE4E0BnpWBCO8y2idBg39 /cag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f14-20020a056402068e00b0051a5b8bde2csi1548020edy.391.2023.07.18.09.09.33; Tue, 18 Jul 2023 09:09:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231582AbjGRPer (ORCPT <rfc822;assdfgzxcv4@gmail.com> + 99 others); Tue, 18 Jul 2023 11:34:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233728AbjGRPei (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 18 Jul 2023 11:34:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE2551AC for <linux-kernel@vger.kernel.org>; Tue, 18 Jul 2023 08:34:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8BFA061638 for <linux-kernel@vger.kernel.org>; Tue, 18 Jul 2023 15:34:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71956C433C7; Tue, 18 Jul 2023 15:34:11 +0000 (UTC) From: Huacai Chen <chenhuacai@loongson.cn> To: Huacai Chen <chenhuacai@kernel.org> Cc: loongarch@lists.linux.dev, Xuefeng Li <lixuefeng@loongson.cn>, Guo Ren <guoren@kernel.org>, Xuerui Wang <kernel@xen0n.name>, Jiaxun Yang <jiaxun.yang@flygoat.com>, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn, Zhihong Dong <donmor3000@hotmail.com>, Huacai Chen <chenhuacai@loongson.cn> Subject: [PATCH v5] LoongArch: Fix CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER handling Date: Tue, 18 Jul 2023 23:33:48 +0800 Message-Id: <20230718153348.3340811-1-chenhuacai@loongson.cn> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771775299298614117 X-GMAIL-MSGID: 1771775299298614117 |
Series |
[v5] LoongArch: Fix CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER handling
|
|
Commit Message
Huacai Chen
July 18, 2023, 3:33 p.m. UTC
From: Zhihong Dong <donmor3000@hotmail.com> Fix CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER handling. The touched function is bootcmdline_init(). There's already code handling CONFIG_CMDLINE_FORCE that replaces boot_command_line with CONFIG_CMDLINE and immediately `goto out`. There should be some similar logic to handle CONFIG_CMDLINE_EXTEND and CONFIG_CMDLINE_BOOTLOADER, so this patch add some code to fix it. Signed-off-by: Zhihong Dong <donmor3000@hotmail.com> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> --- v4 -> v5: Update commit message and adjust the code logic. v3 -> v4: Make CONFIG_CMDLINE appended to the end of command line (Huacai); Removed unnecessary #ifdef since CONFIG_CMDLINE is always a string on LoongArch Reworded comments Reworded the subject of commit message (Huacai) v2 -> v3: Reworded the commit message again to make it imperative (Ruoyao) v1 -> v2: Reworded the commit message so it's more imperative (Markus); Added `goto out` to FDT part (Huacai) arch/loongarch/kernel/setup.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
Comments
Hi, Markus, On Wed, Jul 19, 2023 at 2:51 PM Markus Elfring <Markus.Elfring@web.de> wrote: > > > …, so this patch add > > some code to fix it. > > Would you like to avoid a typo here? > > Will any other imperative change description variant become more helpful? Thank you for pointing this out, but since Zhihong is the original author, I don't want to completely rewrite the commit message, so just fix the typo... Huacai > > See also: > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.5-rc2#n94 > > Regards, > Markus
On 2023/7/19 15:22, Huacai Chen wrote: > Hi, Markus, > > On Wed, Jul 19, 2023 at 2:51 PM Markus Elfring <Markus.Elfring@web.de> wrote: >> >>> …, so this patch add >>> some code to fix it. >> >> Would you like to avoid a typo here? >> >> Will any other imperative change description variant become more helpful? > Thank you for pointing this out, but since Zhihong is the original > author, I don't want to completely rewrite the commit message, so just > fix the typo... AFAICT the commit message is totally uninformative even if "an imperative change description" were used. It basically: 1. repeated the patch title, 2. spent one sentence only for mentioning a function name without giving any more information, 3. mentioned why some change was not necessary due to some other existing code, but not explicitly calling that part out, then 4. finished with a sentence that boiled down to "we should do the similar thing". My take: > Subject: Fix CMDLINE_EXTEND and CMDLINE_BOOTLOADER on non-FDT systems > > On FDT systems these command line processing are already taken care of > by early_init_dt_scan_chosen(). Add similar handling to the non-FDT > code path to allow these config options to work for non-FDT boxes too. Would this sound better?
在 2023-07-19星期三的 18:29 +0800,WANG Xuerui写道: > On 2023/7/19 15:22, Huacai Chen wrote: > > Hi, Markus, > > > > On Wed, Jul 19, 2023 at 2:51 PM Markus Elfring <Markus.Elfring@web.de> wrote: > > > > …, so this patch add > > > > some code to fix it. > > > > > > Would you like to avoid a typo here? > > > > > > Will any other imperative change description variant become more helpful? > > Thank you for pointing this out, but since Zhihong is the original > > author, I don't want to completely rewrite the commit message, so just > > fix the typo... > > AFAICT the commit message is totally uninformative even if "an > imperative change description" were used. It basically: > > 1. repeated the patch title, > 2. spent one sentence only for mentioning a function name without giving > any more information, > 3. mentioned why some change was not necessary due to some other > existing code, but not explicitly calling that part out, then > 4. finished with a sentence that boiled down to "we should do the > similar thing". > > My take: > > > Subject: Fix CMDLINE_EXTEND and CMDLINE_BOOTLOADER on non-FDT systems > > > > On FDT systems these command line processing are already taken care of > > by early_init_dt_scan_chosen(). Add similar handling to the non-FDT > > code path to allow these config options to work for non-FDT boxes too. > > Would this sound better? > Xuerui's take is fine. Do I need to make a v6 patch? donmor
On Thu, Jul 20, 2023 at 9:35 AM donmor <donmor3000@hotmail.com> wrote: > > 在 2023-07-19星期三的 18:29 +0800,WANG Xuerui写道: > > On 2023/7/19 15:22, Huacai Chen wrote: > > > Hi, Markus, > > > > > > On Wed, Jul 19, 2023 at 2:51 PM Markus Elfring <Markus.Elfring@web.de> wrote: > > > > > …, so this patch add > > > > > some code to fix it. > > > > > > > > Would you like to avoid a typo here? > > > > > > > > Will any other imperative change description variant become more helpful? > > > Thank you for pointing this out, but since Zhihong is the original > > > author, I don't want to completely rewrite the commit message, so just > > > fix the typo... > > > > AFAICT the commit message is totally uninformative even if "an > > imperative change description" were used. It basically: > > > > 1. repeated the patch title, > > 2. spent one sentence only for mentioning a function name without giving > > any more information, > > 3. mentioned why some change was not necessary due to some other > > existing code, but not explicitly calling that part out, then > > 4. finished with a sentence that boiled down to "we should do the > > similar thing". > > > > My take: > > > > > Subject: Fix CMDLINE_EXTEND and CMDLINE_BOOTLOADER on non-FDT systems > > > > > > On FDT systems these command line processing are already taken care of > > > by early_init_dt_scan_chosen(). Add similar handling to the non-FDT > > > code path to allow these config options to work for non-FDT boxes too. > > > > Would this sound better? > > > Xuerui's take is fine. Do I need to make a v6 patch? OK, if you have time please do that. Huacai > > donmor
diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.c index 95e6b579dfdd..5a6f61ed567f 100644 --- a/arch/loongarch/kernel/setup.c +++ b/arch/loongarch/kernel/setup.c @@ -332,9 +332,25 @@ 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 + /* + * Append built-in command line to the bootloader command line if + * CONFIG_CMDLINE_EXTEND is enabled. + */ + if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) && CONFIG_CMDLINE[0]) { + strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); + strlcat(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); + } + + /* + * Use built-in command line if the bootloader command line is empty. + */ + if ((IS_ENABLED(CONFIG_CMDLINE_BOOTLOADER) && !boot_command_line[0]) + strscpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE); + out: *cmdline_p = boot_command_line; }