Re: [PATCH 1/1] mtd: add | as a separator after mtd-id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx> 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@xxxxxxxxxx>
> 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/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux