linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: ron minnich <rminnich@gmail.com>
Cc: Richard Weinberger <richard@nod.at>,
	linux-mtd@lists.infradead.org,
	Vignesh Raghavendra <vigneshr@ti.com>,
	mika.westerberg@linux.intel.com
Subject: Re: [PATCH 1/1] mtd/intel-spi: Support cmdline-based partition
Date: Fri, 27 Mar 2020 17:15:31 +0100	[thread overview]
Message-ID: <20200327171532.0947ed92@xps13> (raw)
In-Reply-To: <CAP6exYJ_jzrB0D=RLXMNeegu4BwQq8raXVOMugkqzX2ZP_JSqw@mail.gmail.com>

Hi Ronald,

ron minnich <rminnich@gmail.com> wrote on Fri, 27 Mar 2020 08:48:39
-0700:

> anyone? This is in our internal tree but I'd like to get it upstreamed
> if possible.

Maybe it is one of your fist contributions and I thank you very much
for trying to keep Google's tree aligned with mainline by upstreaming
this kind of change with enthusiasm, this is appreciated.

However, please note that a 2 days ping (and this is the second time you
do it) is a bit of an impatient move. Also, please have in mind the
maintainer's schedule: we freeze our branches about a week before
sending them to Linus. The SPI-NOR pull-request has been sent earlier
this week already so this patch will not reach mainline in v5.7 anyway.

Last generic comment, the subject prefix is wrong, so if you want the
SPI-NOR maintainer to care, better use the right one to catch his eye
;) "mtd: spi-nor: intel-spi:" seems more appropriate.

More comments below :)

> 
> On Wed, Mar 25, 2020 at 10:34 AM ron minnich <rminnich@gmail.com> wrote:
> >
> > Sorry, on that first one, I forgot the checkpatch. This one is clean.

When resending, please:
- increment the version with git-format-patch -v<x>
- write a changelog explaining what are the changes below the three
  dashes '---'.
- do not answer your previous version

> >
> > thanks
> >
> > On Wed, Mar 25, 2020 at 10:34 AM 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.

s/id/Linux MTD device ID/             ^^

s/partdef/partition definition/                   ^^^^^^^

> > >
> > > The mtdparts can define more than one part, in which case

What about:

"The mtdparts cmdline parameter can define the partitioning of several
MTD devices, in which case"...
                                            
> > > there will be more than one <mtd-id>:<partdef> component.
> > >
> > > On Intel spi devices, the name is set to the PCI slot name,

               SPI

> > > e.g. 0000:00:1f.5.  There are two : in the name alone.

                                        ':'

> > > Since strchr is used to find the <mtd-id>,
> > > in this case it will return the wrong
> > > result. Using strrchr is not an option, as there may

What about:
      result as ':' is part of the parameter syntax.
 
> > > be more than one mtddef in the argument.

Not sure the strrchr mentiont is relevant here. I'd drop it.

> > >
> > > This change modifies the name attached to the intel spi

      Change the name attached to the Intel SPI device, ...

> > > device, changing all ':' to '.', e.g. 0000:00:1f.5
> > > becomes 0000.00.1f.5. It also adds command line partition
> > > parsing registration to the intel_spi_probe function.
> > >
> > > Signed-off-by: Ronald G. Minnich <rminnich@google.com>
> > > Change-Id: Ibfa5caba51b8cdd3c41c60b15f8f8c583ded82ff

Change-ID can be dropped too.

> > > ---
> > >  drivers/mtd/spi-nor/intel-spi-pci.c | 23 +++++++++++++++++++++++
> > >  drivers/mtd/spi-nor/intel-spi.c     |  5 ++++-
> > >  2 files changed, 27 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/mtd/spi-nor/intel-spi-pci.c
> > > b/drivers/mtd/spi-nor/intel-spi-pci.c
> > > index 81329f680bec..dc608d74e824 100644
> > > --- a/drivers/mtd/spi-nor/intel-spi-pci.c
> > > +++ b/drivers/mtd/spi-nor/intel-spi-pci.c
> > > @@ -24,6 +24,24 @@ static const struct intel_spi_boardinfo cnl_info = {
> > >      .type = INTEL_SPI_CNL,
> > >  };
> > >
> > > +/*
> > > + * PCI names use a ':' as a separator, which conflicts
> > > + * with the mtdparts cmdline parameter. Dup the name and

s/dup/duplicate/

> > > + * replace : with .
> > > + */
> > > +static int fixname(struct pci_dev *pdev)
> > > +{
> > > +    char *name;
> > > +
> > > +    name = kstrdup(pci_name(pdev), GFP_KERNEL);
> > > +    if (!name)
> > > +        return -ENOMEM;

new line

> > > +    strreplace(name, ':', '.');
> > > +    dev_set_name(&pdev->dev, name);
> > > +    kfree(name);

new line

> > > +    return 0;
> > > +}
> > > +
> > >  static int intel_spi_pci_probe(struct pci_dev *pdev,
> > >                     const struct pci_device_id *id)
> > >  {
> > > @@ -41,6 +59,11 @@ static int intel_spi_pci_probe(struct pci_dev *pdev,
> > >      if (!info)
> > >          return -ENOMEM;
> > >
> > > +    if (fixname(pdev)) {

	ret = fixname(pdev);
	if (ret) {
		kfree(info);
		return ret;
	}

> > > +        kfree(info);
> > > +        return -ENOMEM;
> > > +    }
> > > +
> > >      /* Try to make the chip read/write */
> > >      pci_read_config_dword(pdev, BCR, &bcr);
> > >      if (!(bcr & BCR_WPD)) {
> > > diff --git a/drivers/mtd/spi-nor/intel-spi.c b/drivers/mtd/spi-nor/intel-spi.c
> > > index 61d2a0ad2131..cb08ee4d2029 100644
> > > --- a/drivers/mtd/spi-nor/intel-spi.c
> > > +++ b/drivers/mtd/spi-nor/intel-spi.c
> > > @@ -894,6 +894,8 @@ static const struct spi_nor_controller_ops
> > > intel_spi_controller_ops = {
> > >      .erase = intel_spi_erase,
> > >  };
> > >
> > > +static const char * const part_probes[] = { "cmdlinepart", NULL };
> > > +
> > >  struct intel_spi *intel_spi_probe(struct device *dev,
> > >      struct resource *mem, const struct intel_spi_boardinfo *info)
> > >  {
> > > @@ -941,7 +943,8 @@ struct intel_spi *intel_spi_probe(struct device *dev,
> > >      if (!ispi->writeable || !writeable)
> > >          ispi->nor.mtd.flags &= ~MTD_WRITEABLE;
> > >
> > > -    ret = mtd_device_register(&ispi->nor.mtd, &part, 1);
> > > +    ret = mtd_device_parse_register(&ispi->nor.mtd, part_probes,
> > > +                    NULL, &part, 1);

Wrong alignment here I guess


Should these two changes be separated (changing the name, registering
the device with the cmdline parser)?

> > >
> > >      if (ret)
> > >          return ERR_PTR(ret);
> > >
> > > --
> > > 2.25.1.696.g5e7596f4ac-goog  

Thanks,
Miquèl

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

      parent reply	other threads:[~2020-03-27 16:16 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23 19:58 [PATCH 1/1] mtd/intel-spi: Support cmdline-based partition ron minnich
2020-03-23 23:19 ` ron minnich
2020-03-25 17:34   ` ron minnich
2020-03-25 17:34     ` ron minnich
2020-03-27 15:48       ` ron minnich
2020-03-27 15:56         ` Mika Westerberg
2020-03-27 16:19           ` Miquel Raynal
2020-03-27 16:48             ` Mika Westerberg
2020-03-27 16:52               ` Miquel Raynal
2020-03-27 17:05                 ` ron minnich
2020-03-27 17:16                   ` Mika Westerberg
2020-03-27 17:39                     ` ron minnich
2020-03-27 23:53                       ` ron minnich
2020-03-30  6:08                         ` Mika Westerberg
2020-03-30  7:27                           ` Miquel Raynal
2020-03-30 15:53                             ` ron minnich
2020-04-01  7:41                               ` Miquel Raynal
2020-04-01 15:42                                 ` ron minnich
2020-04-01 19:49                                   ` ron minnich
2020-04-27  9:16                                 ` Boris Brezillon
2020-04-27  9:49                                   ` Boris Brezillon
2020-04-27 14:41                                     ` Miquel Raynal
2020-04-27 18:48                                       ` ron minnich
2020-04-27 18:50                                         ` ron minnich
2020-04-27 18:56                                           ` Miquel Raynal
2020-04-27 18:59                                             ` ron minnich
2020-04-27 19:21                                             ` Boris Brezillon
2020-04-27 19:31                                               ` ron minnich
2020-04-27 20:31                                     ` ron minnich
2020-04-27 21:20                                       ` Miquel Raynal
2020-03-27 16:53             ` ron minnich
2020-03-27 16:15         ` Miquel Raynal [this message]

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=20200327171532.0947ed92@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=richard@nod.at \
    --cc=rminnich@gmail.com \
    --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).