From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Boris Brezillon <boris.brezillon@bootlin.com>
Cc: David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
linux-mtd@lists.infradead.org,
Joern Engel <joern@lazybastard.org>,
Robert Jarzmik <robert.jarzmik@free.fr>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
Kyungmin Park <kyungmin.park@samsung.com>,
Artem Bityutskiy <dedekind1@gmail.com>,
Solarflare linux maintainers <linux-net-drivers@solarflare.com>,
Edward Cree <ecree@solarflare.com>,
Bert Kenward <bkenward@solarflare.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org,
devel@driverdev.osuosl.org
Subject: Re: [PATCH 5/5] mtd: Stop updating erase_info->state and calling mtd_erase_callback()
Date: Tue, 13 Feb 2018 09:33:36 +0100 [thread overview]
Message-ID: <20180213093336.1172fe82@xps13> (raw)
In-Reply-To: <20180213091714.5eca4f45@bbrezillon>
Hi Boris,
On Tue, 13 Feb 2018 09:17:14 +0100, Boris Brezillon
<boris.brezillon@bootlin.com> wrote:
> On Tue, 13 Feb 2018 08:42:46 +0100
> Miquel Raynal <miquel.raynal@bootlin.com> wrote:
>
> > Hi Boris,
> >
> > Just a few comments about the form.
> >
> > Otherwise:
> > Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
> >
> >
> > > diff --git a/drivers/mtd/devices/lart.c b/drivers/mtd/devices/lart.c
> > > index 555b94406e0b..3d6c8ffd351f 100644
> > > --- a/drivers/mtd/devices/lart.c
> > > +++ b/drivers/mtd/devices/lart.c
> > > @@ -415,7 +415,6 @@ static int flash_erase (struct mtd_info *mtd,struct erase_info *instr)
> > > {
> > > if (!erase_block (addr))
> > > {
> > > - instr->state = MTD_ERASE_FAILED;
> > > return (-EIO);
> > > }
> >
> > You can also safely remove these '{' '}'
>
> Well, this patch is not about fixing coding style issues, otherwise I'd
> have a lot more work on this driver :-)
Sure, I was not referring to the weird style but just that you switch
from two to one line in the block, thus the braces are not needed
anymore.
>
> >
> > >
> > > @@ -425,9 +424,6 @@ static int flash_erase (struct mtd_info *mtd,struct erase_info *instr)
> > > if (addr == mtd->eraseregions[i].offset + (mtd->eraseregions[i].erasesize * mtd->eraseregions[i].numblocks)) i++;
> > > }
> > >
> > > - instr->state = MTD_ERASE_DONE;
> > > - mtd_erase_callback(instr);
> > > -
> > > return (0);
> > > }
> > >
> > > diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c
> > > index 5dc8bd042cc5..aaaeaae01e1d 100644
> > > --- a/drivers/mtd/devices/mtd_dataflash.c
> > > +++ b/drivers/mtd/devices/mtd_dataflash.c
> > > @@ -220,10 +220,6 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr)
> > > }
> > > mutex_unlock(&priv->lock);
> > >
> > > - /* Inform MTD subsystem that erase is complete */
> > > - instr->state = MTD_ERASE_DONE;
> > > - mtd_erase_callback(instr);
> > > -
> > > return 0;
> > > }
> > >
> > > diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c
> > > index 0bf4aeaf0cb8..efef43c6684b 100644
> > > --- a/drivers/mtd/devices/mtdram.c
> > > +++ b/drivers/mtd/devices/mtdram.c
> > > @@ -60,8 +60,6 @@ static int ram_erase(struct mtd_info *mtd, struct erase_info *instr)
> > > if (check_offs_len(mtd, instr->addr, instr->len))
> > > return -EINVAL;
> > > memset((char *)mtd->priv + instr->addr, 0xff, instr->len);
> > > - instr->state = MTD_ERASE_DONE;
> > > - mtd_erase_callback(instr);
> >
> > Space ?
>
> I could add a blank line, but again, I'm just following the coding style
> in place in this file :-).
Ok.
>
> >
> > > return 0;
> > > }
> > >
> > > diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c
> > > index 7287696a21f9..a963c88d392d 100644
> > > --- a/drivers/mtd/devices/phram.c
> > > +++ b/drivers/mtd/devices/phram.c
> > > @@ -44,8 +44,6 @@ static int phram_erase(struct mtd_info *mtd, struct erase_info *instr)
> > > * I don't feel at all ashamed. This kind of thing is possible anyway
> > > * with flash, but unlikely.
> > > */
> >
> > Not sure this comment is still relevant? Maybe you could remove it
> > or at least change it?
> >
> > > - instr->state = MTD_ERASE_DONE;
> > > - mtd_erase_callback(instr);
> >
> > Space ?
> >
> > > return 0;
> > > }
> > >
> > > diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c
> > > index cadea0620cd0..5d842cbca3de 100644
> > > --- a/drivers/mtd/devices/pmc551.c
> > > +++ b/drivers/mtd/devices/pmc551.c
> > > @@ -184,12 +184,10 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr)
> > > }
> > >
> > > out:
> > > - instr->state = MTD_ERASE_DONE;
> > > #ifdef CONFIG_MTD_PMC551_DEBUG
> > > printk(KERN_DEBUG "pmc551_erase() done\n");
> > > #endif
> > >
> > > - mtd_erase_callback(instr);
> > > return 0;
> > > }
> > >
> > > diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c
> > > index 26f9feaa5d17..5f383630c16f 100644
> > > --- a/drivers/mtd/devices/powernv_flash.c
> > > +++ b/drivers/mtd/devices/powernv_flash.c
> > > @@ -175,19 +175,12 @@ static int powernv_flash_erase(struct mtd_info *mtd, struct erase_info *erase)
> > > {
> > > int rc;
> > >
> > > - erase->state = MTD_ERASING;
> > > -
> > > /* todo: register our own notifier to do a true async implementation */
> > > rc = powernv_flash_async_op(mtd, FLASH_OP_ERASE, erase->addr,
> > > erase->len, NULL, NULL);
> >
> > Are you sure this is still needed? Maybe this should go away in your
> > first patch?
>
> Hm, indeed. This comment should be dropped.
>
> >
> > > -
> > > - if (rc) {
> > > + if (rc)
> > > erase->fail_addr = erase->addr;
> > > - erase->state = MTD_ERASE_FAILED;
> > > - } else {
> > > - erase->state = MTD_ERASE_DONE;
> > > - }
> > > - mtd_erase_callback(erase);
> > > +
> > > return rc;
> > > }
> > >
> > > diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c
> > > index 0ec85f316d24..2f05e1801047 100644
> > > --- a/drivers/mtd/devices/slram.c
> > > +++ b/drivers/mtd/devices/slram.c
> > > @@ -88,8 +88,6 @@ static int slram_erase(struct mtd_info *mtd, struct erase_info *instr)
> > > * I don't feel at all ashamed. This kind of thing is possible anyway
> > > * with flash, but unlikely.
> > > */
> >
> > Same with this comment.
>
> Actually, I'm not sure I understand that comment, but I guess it's
> talking about races between read/write and erase paths, so nothing
> related to the changed I'm doing here.
I thought that races could only happen because of the asynchronous
manner how erases were handled, but if you feel this is still relevant,
I trust you :)
>
> >
> > > - instr->state = MTD_ERASE_DONE;
> > > - mtd_erase_callback(instr);
> >
> > Space ?
> >
> > > return(0);
> > > }
> > >
> >
> >
> >
> >
>
>
>
--
Miquel Raynal, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
http://bootlin.com
next prev parent reply other threads:[~2018-02-13 8:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-12 21:03 [PATCH 0/5] mtd: Simplify erase handling Boris Brezillon
2018-02-12 21:03 ` [PATCH 1/5] mtd: Initialize ->fail_addr early in mtd_erase() Boris Brezillon
2018-02-12 21:47 ` Richard Weinberger
2018-03-18 21:22 ` Boris Brezillon
2018-02-12 21:03 ` [PATCH 2/5] mtd: Get rid of unused fields in struct erase_info Boris Brezillon
2018-02-12 21:47 ` Richard Weinberger
2018-02-12 21:03 ` [PATCH 3/5] mtd: Stop assuming mtd_erase() is asynchronous Boris Brezillon
2018-02-12 21:58 ` Richard Weinberger
2018-02-12 21:03 ` [PATCH 4/5] mtd: Unconditionally update ->fail_addr and ->addr in part_erase() Boris Brezillon
2018-02-12 22:05 ` Richard Weinberger
2018-02-12 21:03 ` [PATCH 5/5] mtd: Stop updating erase_info->state and calling mtd_erase_callback() Boris Brezillon
2018-02-12 22:17 ` Richard Weinberger
2018-02-13 7:42 ` Miquel Raynal
2018-02-13 8:17 ` Boris Brezillon
2018-02-13 8:33 ` Miquel Raynal [this message]
2018-02-13 12:09 ` Bert Kenward
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=20180213093336.1172fe82@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=benh@kernel.crashing.org \
--cc=bkenward@solarflare.com \
--cc=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=cyrille.pitchen@wedev4u.fr \
--cc=dedekind1@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=dwmw2@infradead.org \
--cc=ecree@solarflare.com \
--cc=gregkh@linuxfoundation.org \
--cc=joern@lazybastard.org \
--cc=kyungmin.park@samsung.com \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-net-drivers@solarflare.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=marek.vasut@gmail.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=paulus@samba.org \
--cc=richard@nod.at \
--cc=robert.jarzmik@free.fr \
/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).