From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miquel Raynal Date: Wed, 1 Aug 2018 10:18:45 +0200 Subject: [U-Boot] [PATCH v6 24/27] cmd: mtdparts: remove useless 'mtdparts=' prefix In-Reply-To: <20180801081848.19398-1-miquel.raynal@bootlin.com> References: <20180801081848.19398-1-miquel.raynal@bootlin.com> Message-ID: <20180801081848.19398-25-miquel.raynal@bootlin.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de All U-Boot users must define the mtdparts environment variable with: setenv mtdparts mtdparts=... This is a pure software limitation and is a complete non-sense. Remove this limitation but keep the backward compatibility. Signed-off-by: Miquel Raynal Acked-by: Jagan Teki --- cmd/mtdparts.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c index 27e84db0e4..ef8588bd71 100644 --- a/cmd/mtdparts.c +++ b/cmd/mtdparts.c @@ -44,7 +44,7 @@ * * 'mtdparts' - partition list * - * mtdparts=mtdparts=[;...] + * mtdparts=[mtdparts=][;...] * * := :[,...] * := unique device tag used by linux kernel to find mtd device (mtd->name) @@ -62,11 +62,11 @@ * * 1 NOR Flash, with 1 single writable partition: * mtdids=nor0=edb7312-nor - * mtdparts=mtdparts=edb7312-nor:- + * mtdparts=[mtdparts=]edb7312-nor:- * * 1 NOR Flash with 2 partitions, 1 NAND with one * mtdids=nor0=edb7312-nor,nand0=edb7312-nand - * mtdparts=mtdparts=edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home) + * mtdparts=[mtdparts=]edb7312-nor:256k(ARMboot)ro,-(root);edb7312-nand:-(home) * */ @@ -1167,9 +1167,6 @@ static int generate_mtdparts(char *buf, u32 buflen) return 0; } - strcpy(p, "mtdparts="); - p += 9; - list_for_each(dentry, &devices) { dev = list_entry(dentry, struct mtd_device, link); @@ -1640,11 +1637,9 @@ static int parse_mtdparts(const char *const mtdparts) if (!p) p = mtdparts; - if (strncmp(p, "mtdparts=", 9) != 0) { - printf("mtdparts variable doesn't start with 'mtdparts='\n"); - return err; - } - p += 9; + /* Skip the useless prefix, if any */ + if (strncmp(p, "mtdparts=", 9) == 0) + p += 9; while (*p != '\0') { err = 1; -- 2.14.1