linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ron minnich <rminnich@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>,
	Richard Weinberger <richard@nod.at>,
	 Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH 1/1] mtd: add | as a separator after mtd-id
Date: Sat, 21 Mar 2020 08:44:07 -0700	[thread overview]
Message-ID: <CAP6exY+m7SGgkg1Ng7tzDU8m--vb4bg=Re_C3OX8jdPAZGn17w@mail.gmail.com> (raw)
In-Reply-To: <CAP6exYL889zuXgDhLE3SdwzC4idZ6tbe2oqXQRpZT2M6SrRbFg@mail.gmail.com>

Anyone? This will be going into use at Google internally and I'd like
to get it upstream.

The only other option that would work is to take the pci-format names
created by intel-spi-pci that have : in them and change the : to '.'.
Is that more acceptable?

On Fri, Mar 20, 2020 at 1:21 PM ron minnich <rminnich@gmail.com> wrote:
>
> The MTD subsystem can support command-line defined partitions
> for one or more MTD devices.
>
> The format is:
>  * mtdparts=<mtddef>[;<mtddef]
>  * <mtddef>  := <mtd-id>:<partdef>[,<partdef>]
>
> The ':' currently separates the id from the partdef.
>
> The mtdparts can define more than one part, in which case
> there will be more than one <mtd-id>:<partdef> component.
>
> The problem comes in with newer systems which have MTDs
> attached to a PCI device, which has a PCI name including
> several :'s, e.g. 0000:00:1f.5 on an Intel chipset. Although
> this is largely an x86 problem at the moment, PCI is coming
> to newer ARM systems, and they will hit this issue in future.
>
> There are two : in the name alone. strchr is used to find
> the <mtd-id>, and in this case it will return the wrong
> result. Using strrchr is not an option, as there may
> be more than one mtddef in the argument.
>
> This patch defines a new delimiter, |, to seperate
> the <mtd-id> from the <partdef>. | is rarely used
> in device names, so seems a reasonable choice.
>
> The code first searches for | and, if that fails, searches
> for the old :. Eventually, it ought to be possible to remove
> the support for : entirely, but since mtdparts are also defined
> in FLASH in the device tree on many ARM boards, wholesale removal
> is not yet practical.
>
> This code has been used on real hardware and allowed us to use a
> squashfs in SPI-NOR flash as a root file system, with partitions
> defined on the cmdline.
>
> Signed-off-by: Ronald G. Minnich <rminnich@google.com>
> Change-Id: Ifce3627cb03247bf9e54c8b19d24b60baeed2ec3
> ---
>  drivers/mtd/parsers/cmdlinepart.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/parsers/cmdlinepart.c
> b/drivers/mtd/parsers/cmdlinepart.c
> index c86f2db8c882..eca8ec026d89 100644
> --- a/drivers/mtd/parsers/cmdlinepart.c
> +++ b/drivers/mtd/parsers/cmdlinepart.c
> @@ -223,7 +223,14 @@ static int mtdpart_setup_real(char *s)
>          mtd_id = s;
>
>          /* fetch <mtd-id> */
> -        p = strchr(s, ':');
> +        p = strchr(s, '|');
> +        if (!p) {
> +            /*
> +             * ':' is the older separator, which conflicts
> +             * with PCI IDs T:B:D.F; too many  :'s!
> +             */
> +            p = strchr(s, ':');
> +        }
>          if (!p) {
>              pr_err("no mtd-id\n");
>              return -EINVAL;
> --
> 2.25.1.696.g5e7596f4ac-goog

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2020-03-21 15:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 20:21 [PATCH 1/1] mtd: add | as a separator after mtd-id ron minnich
2020-03-21 15:44 ` ron minnich [this message]
2020-03-22 11:09   ` Miquel Raynal
2020-03-22 15:42     ` ron minnich
2020-03-22 16:00       ` ron minnich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAP6exY+m7SGgkg1Ng7tzDU8m--vb4bg=Re_C3OX8jdPAZGn17w@mail.gmail.com' \
    --to=rminnich@gmail.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).