[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200313103007.7d7ea6af@collabora.com>
Date: Fri, 13 Mar 2020 10:30:07 +0100
From: Boris Brezillon <boris.brezillon@...labora.com>
To: Vignesh Raghavendra <vigneshr@...com>
Cc: <Tudor.Ambarus@...rochip.com>, <bbrezillon@...nel.org>,
<linux-mtd@...ts.infradead.org>, <miquel.raynal@...tlin.com>,
<richard@....at>, <joel@....id.au>, <andrew@...id.au>,
<Nicolas.Ferre@...rochip.com>, <alexandre.belloni@...tlin.com>,
<Ludovic.Desroches@...rochip.com>, <matthias.bgg@...il.com>,
<vz@...ia.com>, <michal.simek@...inx.com>, <ludovic.barre@...com>,
<john.garry@...wei.com>, <tglx@...utronix.de>,
<nishkadg.linux@...il.com>, <michael@...le.cc>,
<dinguyen@...nel.org>, <thor.thayer@...ux.intel.com>,
<swboyd@...omium.org>, <opensource@...ayne.com>,
<mika.westerberg@...ux.intel.com>, <kstewart@...uxfoundation.org>,
<allison@...utok.net>, <jethro@...tanix.com>, <info@...ux.net>,
<alexander.sverdlin@...ia.com>, <rfontana@...hat.com>,
<linux-kernel@...r.kernel.org>,
<linux-mediatek@...ts.infradead.org>,
<linux-aspeed@...ts.ozlabs.org>,
<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH 01/23] mtd: spi-nor: Stop prefixing generic functions
with a manufacturer name
On Fri, 13 Mar 2020 11:34:55 +0530
Vignesh Raghavendra <vigneshr@...com> wrote:
> On 02/03/20 11:37 pm, Tudor.Ambarus@...rochip.com wrote:
> > From: Boris Brezillon <bbrezillon@...nel.org>
> >
> > Replace the manufacturer prefix by something describing more precisely
> > what those functions do.
> >
> > Signed-off-by: Boris Brezillon <bbrezillon@...nel.org>
> > [tudor.ambarus@...rochip.com: prepend spi_nor_ to all modified methods.]
> > Signed-off-by: Tudor Ambarus <tudor.ambarus@...rochip.com>
> > ---
> > drivers/mtd/spi-nor/spi-nor.c | 88 ++++++++++++++++++-----------------
> > 1 file changed, 45 insertions(+), 43 deletions(-)
> >
> > diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
> > index caf0c109cca0..b15e262765e1 100644
> > --- a/drivers/mtd/spi-nor/spi-nor.c
> > +++ b/drivers/mtd/spi-nor/spi-nor.c
> > @@ -568,14 +568,15 @@ static int spi_nor_read_cr(struct spi_nor *nor, u8 *cr)
> > }
> >
> > /**
> > - * macronix_set_4byte() - Set 4-byte address mode for Macronix flashes.
> > + * spi_nor_en4_ex4_set_4byte() - Enter/Exit 4-byte mode for Macronix like
> > + * flashes.
> > * @nor: pointer to 'struct spi_nor'.
> > * @enable: true to enter the 4-byte address mode, false to exit the 4-byte
> > * address mode.
> > *
> > * Return: 0 on success, -errno otherwise.
> > */
> > -static int macronix_set_4byte(struct spi_nor *nor, bool enable)
> > +static int spi_nor_en4_ex4_set_4byte(struct spi_nor *nor, bool enable)
>
>
> Sounds a bit weird, how about simplifying this to:
>
> spi_nor_set_4byte_addr_mode()
>
> Or if you want to be specific:
>
> spi_nor_en_ex_4byte_addr_mode()
You're right. Maybe we can simplify things by having a single function
that does optional steps based on new flags
SPI_NOR_EN_EX_4B_NEEDS_WEN
SPI_NOR_CLEAR_EAR_ON_4B_EXIT
This should probably be done in a separate patch though, so ack on the
spi_nor_en_ex_4byte_addr_mode() rename, assuming we also change the
bool argument name to enter.
>
> > {
> > int ret;
> >
> > @@ -604,14 +605,15 @@ static int macronix_set_4byte(struct spi_nor *nor, bool enable)
> > }
> >
> > /**
> > - * st_micron_set_4byte() - Set 4-byte address mode for ST and Micron flashes.
> > + * spi_nor_en4_ex4_wen_set_4byte() - Set 4-byte address mode for ST and Micron
> > + * flashes.
> > * @nor: pointer to 'struct spi_nor'.
> > * @enable: true to enter the 4-byte address mode, false to exit the 4-byte
> > * address mode.
> > *
> > * Return: 0 on success, -errno otherwise.
> > */
> > -static int st_micron_set_4byte(struct spi_nor *nor, bool enable)
> > +static int spi_nor_en4_ex4_wen_set_4byte(struct spi_nor *nor, bool enable)
>
>
> Unrelated to this patch itself, but can we just have one set_4byte
> variant that uses WREN and drop the other one?
Hm, not sure that's a good idea to insert WEN instructions for
everyone, sounds like a recipe for regressions.
> I expect sending WREN should be harmless even for cmds that don't expect
> one.
In theory yes, but you know flash chips are capricious, so let's not
take the risk of breaking things :-).
>
> Rest looks good to me.
>
> Reviewed-by: Vignesh Raghavendra <vigneshr@...com>
>
Powered by blists - more mailing lists