linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: parser: cmdline: Support MTD names containing one or more colons
@ 2020-04-29 16:53 Ronald G. Minnich
  2020-11-22  0:14 ` Sven Eckelmann
  0 siblings, 1 reply; 13+ messages in thread
From: Ronald G. Minnich @ 2020-04-29 16:53 UTC (permalink / raw)
  Cc: Boris Brezillon, Ron Minnich, David Woodhouse, Brian Norris,
	Boris Brezillon, Marek Vasut, Richard Weinberger,
	Cyrille Pitchen, linux-mtd, linux-kernel

From: Boris Brezillon <boris.brezillon@collabora.com>

Looks like some drivers define MTD names with a colon in it, thus
making mtdpart= parsing impossible. Let's fix the parser to gracefully
handle that case: the last ':' in a partition definition sequence is
considered instead of the first one.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Signed-off-by: Ron Minnich <rminnich@google.com>
Tested-by: Ron Minnich <rminnich@google.com>
---
 drivers/mtd/parsers/cmdlinepart.c | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/parsers/cmdlinepart.c b/drivers/mtd/parsers/cmdlinepart.c
index c86f2db8c882..0625b25620ca 100644
--- a/drivers/mtd/parsers/cmdlinepart.c
+++ b/drivers/mtd/parsers/cmdlinepart.c
@@ -218,12 +218,29 @@ static int mtdpart_setup_real(char *s)
		struct cmdline_mtd_partition *this_mtd;
		struct mtd_partition *parts;
		int mtd_id_len, num_parts;
-		char *p, *mtd_id;
+		char *p, *mtd_id, *semicol;
+
+		/*
+		 * Replace the first ';' by a NULL char so strrchr can work
+		 * properly.
+		 */
+		semicol = strchr(s, ';');
+		if (semicol)
+			*semicol = '\0';

		mtd_id = s;

-		/* fetch <mtd-id> */
-		p = strchr(s, ':');
+		/*
+		 * fetch <mtd-id>. We use strrchr to ignore all ':' that could
+		 * be present in the MTD name, only the last one is interpreted
+		 * as an <mtd-id>/<part-definition> separator.
+		 */
+		p = strrchr(s, ':');
+
+		/* Restore the ';' now. */
+		if (semicol)
+			*semicol = ';';
+
		if (!p) {
			pr_err("no mtd-id\n");
			return -EINVAL;

^ permalink raw reply related	[flat|nested] 13+ messages in thread
* Re: [PATCH] mtd: spi-nor: controllers: intel-spi: Add support for command line partitions
@ 2020-09-25  4:21 Vignesh Raghavendra
  2020-12-23 21:56 ` [PATCH] mtd: parser: cmdline: Support MTD names containing one or more colons Ian Goegebuer
  0 siblings, 1 reply; 13+ messages in thread
From: Vignesh Raghavendra @ 2020-09-25  4:21 UTC (permalink / raw)
  To: Mika Westerberg, Ronald G. Minnich
  Cc: Ronald G. Minnich, Tudor Ambarus, Miquel Raynal,
	Richard Weinberger, Boris Brezillon, Jethro Beekman,
	Greg Kroah-Hartman, Alexander Sverdlin, Thomas Gleixner,
	linux-mtd, linux-kernel



On 4/17/20 9:37 PM, Mika Westerberg wrote:
> On Fri, Apr 17, 2020 at 08:26:11AM -0700, Ronald G. Minnich wrote:
>> On Intel platforms, the usable SPI area is located several
>> MiB in from the start, to leave room for descriptors and
>> the Management Engine binary. Further, not all the remaining
>> space can be used, as the last 16 MiB contains firmware.
>>
>> To make the SPI usable for mtdblock and other devices,
>> it is necessary to enable command line partitions so the
>> middle usable region can be specified.
>>
>> Add a part_probes array which includes only "cmdelineparts",
>> and change to mtd_device_parse_register to use this part_probes.
>>
>> Signed-off-by: Ronald G. Minnich <rminnich@google.com>
> 
> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> 

scripts/checkpatch.pl --strict complains:

CHECK: Alignment should match open parenthesis
#46: FILE: drivers/mtd/spi-nor/controllers/intel-spi.c:956:
+	ret = mtd_device_parse_register(&ispi->nor.mtd, part_probes,
+				       NULL, &part, 1);

WARNING: Missing Signed-off-by: line by nominal patch author '"Ronald G. Minnich" <rminnich@gmail.com>'

Regards
Vignesh

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

end of thread, other threads:[~2021-01-04 16:25 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-29 16:53 [PATCH] mtd: parser: cmdline: Support MTD names containing one or more colons Ronald G. Minnich
2020-11-22  0:14 ` Sven Eckelmann
2020-11-27 16:32   ` ron minnich
2020-11-27 17:05     ` Sven Eckelmann
2020-11-27 17:16       ` ron minnich
2020-11-27 17:35         ` Sven Eckelmann
2020-11-27 18:54           ` ron minnich
2020-12-07  7:52             ` Sven Eckelmann
2020-12-07 15:24               ` ron minnich
2020-12-09 21:34                 ` Ron Minnich
2020-09-25  4:21 [PATCH] mtd: spi-nor: controllers: intel-spi: Add support for command line partitions Vignesh Raghavendra
2020-12-23 21:56 ` [PATCH] mtd: parser: cmdline: Support MTD names containing one or more colons Ian Goegebuer
2021-01-04  9:08   ` Miquel Raynal
2021-01-04 16:24     ` Ron Minnich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).