Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1480928pxb; Thu, 4 Mar 2021 12:26:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJxt1BjvUvf1pZpvxoimu+cA/LuISaTRXhteH1Uwq2ZRZIFCzk2hSkeg7OT4TQICcVCtGUx4 X-Received: by 2002:a50:eb49:: with SMTP id z9mr6636748edp.234.1614889602388; Thu, 04 Mar 2021 12:26:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614889602; cv=none; d=google.com; s=arc-20160816; b=ZNaRZtOOJi+XJG/ZD4v50cSqDwT3L1nEvI4gtC5HGrU2NP6wkwFoDXbBcAfWt2xb/v bbzViKpTS2obv9PZjTxBgMnu0BjgfrxhOfT8z5ddpp7sxW6faaEvI63Iiqj5qUSEiMLH MzjrF6JO2EW8JCXES82URc0nXx/1nnzkyhksMIMUsrpVNvi04KxW4ULJPVnSvoCFhr4I uo3/E/zzOaqqZaxLGJcc5xW7vp52TQeokmO9DI6qR3xznr4fEz2UELIGJu0a99kQoegP Esj+9hgvYZWZp72+J2gHFHk36MQdkbUG0ZI1SnhIluBCb9V7B2PtYJY193lW0E5P6BCD b21w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:cc:to:subject:from:references:in-reply-to :message-id; bh=O5YPz+JgG3yrNSzu+qj/bPMJuwk+NB+kuFtp12xtTdM=; b=o3UaCKw9ANBdpIezHgvA6sYG/VJ1mUs35tveDX4v7dbF5h0JzOq/neQXE/kvABkqWs VeAar3+jCl4hMJ0Fb6u8Dx3eu4Ph09HT3RYRjBD3J59d4P9M/7UixPFD0wCnMKuyxZxx M8A2zCHcPKKzdjglckOJ21A7YOzfDVHgaC8ihtou97/n4HvUA4jHjNmnn8k2hSwFhwZ1 NkA89J6cGEEBG1+fsGZkFxkmVtveoUgq/OsJnmQHt/GkJ0G7T0vNTK5pq/6GWzVh5g/v uZHA20QkmEKi6nTJUc/NI4J4ghTO5HRc48NOMFtquOBTewUXZYZg2FfhxBWlGoaBKMM2 vU9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p17si164859ejd.307.2021.03.04.12.26.18; Thu, 04 Mar 2021 12:26:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1839996AbhCBUvq (ORCPT + 99 others); Tue, 2 Mar 2021 15:51:46 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:13448 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352010AbhCBRvJ (ORCPT ); Tue, 2 Mar 2021 12:51:09 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 4DqkXt3M4Jz9v1C2; Tue, 2 Mar 2021 18:25:18 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id S_DkUCnzN6bf; Tue, 2 Mar 2021 18:25:18 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 4DqkXt1tPQz9v1Bx; Tue, 2 Mar 2021 18:25:18 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id C2F178B7B5; Tue, 2 Mar 2021 18:25:19 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id ycNTALV-gbj4; Tue, 2 Mar 2021 18:25:19 +0100 (CET) Received: from po16121vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6A34C8B75F; Tue, 2 Mar 2021 18:25:19 +0100 (CET) Received: by localhost.localdomain (Postfix, from userid 0) id 44BC5674A2; Tue, 2 Mar 2021 17:25:19 +0000 (UTC) Message-Id: In-Reply-To: References: From: Christophe Leroy Subject: [PATCH v2 3/7] powerpc: convert to generic builtin command line To: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , danielwa@cisco.com, robh@kernel.org, daniel@gimpelevich.san-francisco.ca.us Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arch@vger.kernel.org, devicetree@vger.kernel.org Date: Tue, 2 Mar 2021 17:25:19 +0000 (UTC) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This updates the powerpc code to use the new cmdline building function. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/prom_init.c | 35 +++++---------------------------- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c index ccf77b985c8f..24157e526f80 100644 --- a/arch/powerpc/kernel/prom_init.c +++ b/arch/powerpc/kernel/prom_init.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include @@ -152,7 +153,7 @@ static struct prom_t __prombss prom; static unsigned long __prombss prom_entry; static char __prombss of_stdout_device[256]; -static char __prombss prom_scratch[256]; +static char __prombss prom_scratch[COMMAND_LINE_SIZE]; static unsigned long __prombss dt_header_start; static unsigned long __prombss dt_struct_start, dt_struct_end; @@ -304,26 +305,6 @@ static char __init *prom_strstr(const char *s1, const char *s2) return NULL; } -static size_t __init prom_strlcat(char *dest, const char *src, size_t count) -{ - size_t dsize = prom_strlen(dest); - size_t len = prom_strlen(src); - size_t res = dsize + len; - - /* This would be a bug */ - if (dsize >= count) - return count; - - dest += dsize; - count -= dsize; - if (len >= count) - len = count-1; - memcpy(dest, src, len); - dest[len] = 0; - return res; - -} - #ifdef CONFIG_PPC_PSERIES static int __init prom_strtobool(const char *s, bool *res) { @@ -768,19 +749,13 @@ static unsigned long prom_memparse(const char *ptr, const char **retptr) static void __init early_cmdline_parse(void) { const char *opt; - - char *p; int l = 0; - prom_cmd_line[0] = 0; - p = prom_cmd_line; - if (!IS_ENABLED(CONFIG_CMDLINE_FORCE) && (long)prom.chosen > 0) - l = prom_getprop(prom.chosen, "bootargs", p, COMMAND_LINE_SIZE-1); + l = prom_getprop(prom.chosen, "bootargs", prom_scratch, + COMMAND_LINE_SIZE - 1); - if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || l <= 0 || p[0] == '\0') - prom_strlcat(prom_cmd_line, " " CONFIG_CMDLINE, - sizeof(prom_cmd_line)); + cmdline_build(prom_cmd_line, l > 0 ? prom_scratch : NULL, sizeof(prom_scratch)); prom_printf("command line: %s\n", prom_cmd_line); -- 2.25.0