linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Dinh Nguyen <dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Brian Norris
	<computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
	Krzysztof Kozlowski
	<k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	"linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>,
	Nicolas Ferre
	<nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>,
	Stefan Agner <stefan-XLVq0VzYD2Y@public.gmane.org>,
	linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	Alexandre Belloni
	<alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
	Robert Jarzmik <robert.jarzmik-GANU6spQydw@public.gmane.org>,
	Alexander Clouter <alex-L4GPcECwBoDe9xe1eoZjHA@public.gmane.org>,
	"devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org"
	<devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org>,
	Jesper Nilsson <jesper.nilsson-VrBV9hrLPhE@public.gmane.org>,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Maxim Levitsky
	<maximlevitsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Jonathan Corbet <corbet-T1hC0tSOHrs@public.gmane.org>,
	Marek Vasut <marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
	Kukjin Kim <kgene-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Ezequiel Garcia
	<ezequiel.garcia-wi1+55ScJUtKEb57/3fJTGGXanvQGlWp@public.gmane.org>
Subject: Re: [PATCH v5 01/58] mtd: nand: denali: add missing nand_release() call in denali_remove()
Date: Fri, 11 Dec 2015 18:08:55 +0100	[thread overview]
Message-ID: <20151211180855.47c95df2@bbrezillon> (raw)
In-Reply-To: <CADhT+wcNFxD6Zv9w8W0sontVWa6zOkHjyK42Tw=Y_1X2XCTZfQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi Dinh,

On Fri, 11 Dec 2015 10:50:21 -0600
Dinh Nguyen <dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> Hi Boris,
> 
> On Fri, Dec 11, 2015 at 9:10 AM, Boris Brezillon
> <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> > + Dinh (who made commit 2a0a288ec258)
> >
> > Also added back the Fixes tag.
> >
> > On Fri, 11 Dec 2015 15:02:34 +0100
> > Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> >
> >> Unregister the NAND device from the NAND subsystem when removing a denali
> >> NAND controller, otherwise the MTD attached to the NAND device is still
> >> exposed by the MTD layer, and accesses to this device will likely crash
> >> the system.
> >>
> >> Signed-off-by: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> >
> > Fixes: 2a0a288ec258 ("mtd: denali: split the generic driver and PCI layer")
> >
> >> ---
> >> Changes since v4:
> >> - remove Cc stable and fixes tags
> >> - calculate the dma buffer size before calling nand_release()
> >>
> >>  drivers/mtd/nand/denali.c | 6 ++++--
> >>  1 file changed, 4 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
> >> index 67eb2be..fdfea05 100644
> >> --- a/drivers/mtd/nand/denali.c
> >> +++ b/drivers/mtd/nand/denali.c
> >> @@ -1622,9 +1622,11 @@ EXPORT_SYMBOL(denali_init);
> >>  /* driver exit point */
> >>  void denali_remove(struct denali_nand_info *denali)
> >>  {
> >> +     int bufsize = denali->mtd.writesize + denali->mtd.oobsize;
> >> +
> >> +     nand_release(&denali->mtd);
> >>       denali_irq_cleanup(denali->irq, denali);
> >> -     dma_unmap_single(denali->dev, denali->buf.dma_buf,
> >> -                      denali->mtd.writesize + denali->mtd.oobsize,
> >> +     dma_unmap_single(denali->dev, denali->buf.dma_buf, bufsize,
> >>                        DMA_BIDIRECTIONAL);
> 
> Not sure what is the need to add bufsize here, but the commit message
> doesn't reflect the change.

You were not in Cc of the first version (my fault), but Brian pointed
that the mtd fields could be in an unknown state after the
nand_release() call (this is currently not the case, but it change in
the future). The idea is to pre-compute the DMA buffer size before
releasing the mtd/nand device to prevent any future issues.

I don't think it is worth mentioning this in the commit message,
because these are just implementation details, but I can add the
following comment before the bufsize declaration:

	/*
	 * Pre-compute DMA buffer size to avoid any problems in case
	 * nand_release() ever changes in a way that mtd->writesize and
	 * mtd->oobsize are not reliable after this call.
	 */

What do you think?

Best Regards,

Boris

> 
> Dinh



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

  parent reply	other threads:[~2015-12-11 17:08 UTC|newest]

Thread overview: 75+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10  7:59 [PATCH v4 00/58] mtd: nand: refactor the NAND subsystem (part 1) Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 27/58] mtd: nand: mpc5121: use the mtd instance embedded in struct nand_chip Boris Brezillon
2015-12-10  8:00 ` [PATCH v4 30/58] mtd: nand: ndfc: " Boris Brezillon
     [not found] ` <1449734442-18672-1-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-12-10  7:59   ` [PATCH v4 01/58] mtd: nand: denali: add missing nand_release() call in denali_remove() Boris Brezillon
     [not found]     ` <1449734442-18672-2-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-12-11  0:40       ` Brian Norris
     [not found]         ` <20151211004008.GQ144338-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2015-12-11 13:53           ` Boris Brezillon
2015-12-11 14:39             ` Dan Carpenter
2015-12-11 15:15               ` Boris Brezillon
2015-12-11 22:03           ` Boris Brezillon
2015-12-11 22:11             ` Brian Norris
2015-12-11 14:02       ` [PATCH v5 " Boris Brezillon
     [not found]         ` <1449842554-29898-1-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-12-11 15:10           ` Boris Brezillon
2015-12-11 16:50             ` Dinh Nguyen
     [not found]               ` <CADhT+wcNFxD6Zv9w8W0sontVWa6zOkHjyK42Tw=Y_1X2XCTZfQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-12-11 17:08                 ` Boris Brezillon [this message]
2015-12-11 17:21                   ` Dinh Nguyen
2015-12-10  7:59   ` [PATCH v4 02/58] mtd: nand: fsmc: create and use mtd_to_fsmc() Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 03/58] mtd: nand: nuc900: create and use mtd_to_nuc900() Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 04/58] mtd: nand: omap2: create and use mtd_to_omap() Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 05/58] mtd: nand: ams-delta: use the mtd instance embedded in struct nand_chip Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 06/58] mtd: nand: atmel: " Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 07/58] mtd: nand: au1550nd: " Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 08/58] mtd: nand: bcm47xx: " Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 09/58] mtd: nand: bf5xx: " Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 10/58] mtd: nand: brcm: " Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 11/58] mtd: nand: cafe: " Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 12/58] mtd: nand: cmx270: " Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 13/58] mtd: nand: cs553x: " Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 14/58] mtd: nand: davinci: " Boris Brezillon
2015-12-10  7:59   ` [PATCH v4 15/58] mtd: nand: denali: " Boris Brezillon
     [not found]     ` <1449734442-18672-16-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-12-11 14:06       ` [PATCH v5 " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 16/58] mtd: nand: diskonchip: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 17/58] mtd: nand: docg4: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 18/58] mtd: nand: fsl_elbc: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 19/58] mtd: nand: fsl_ifc: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 20/58] mtd: nand: fsl_upm: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 21/58] mtd: nand: fsmc: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 22/58] mtd: nand: gpio: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 23/58] mtd: nand: gpmi: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 24/58] mtd: nand: hisi504: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 25/58] mtd: nand: jz4740: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 26/58] mtd: nand: lpc32xx: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 28/58] mtd: nand: mxc: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 29/58] mtd: nand: nandsim: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 31/58] mtd: nand: nuc900: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 32/58] mtd: nand: omap2: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 33/58] mtd: nand: orion: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 34/58] mtd: nand: pasemi: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 35/58] mtd: nand: plat: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 36/58] mtd: nand: pxa3xx: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 37/58] mtd: nand: r852: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 38/58] mtd: nand: s3c2410: " Boris Brezillon
     [not found]     ` <1449734442-18672-39-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-12-11  2:38       ` Krzysztof Kozlowski
2015-12-10  8:00   ` [PATCH v4 39/58] mtd: nand: sh_flctl: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 40/58] mtd: nand: sharpsl: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 41/58] mtd: nand: socrates: " Boris Brezillon
2015-12-11 14:04     ` [PATCH v5 " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 42/58] mtd: nand: sunxi: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 43/58] mtd: nand: tmio: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 44/58] mtd: nand: txx9ndfmc: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 45/58] mtd: nand: vf610: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 46/58] mtd: nand: update the documentation to reflect framework changes Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 47/58] staging: mt29f_spinand: use the mtd instance embedded in struct nand_chip Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 48/58] cris: nand: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 49/58] mtd: nand: update mtd_to_nand() Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 50/58] mtd: nand: remove useless mtd->priv = chip assignments Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 51/58] cris: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 52/58] staging: mt29f_spinand: remove useless mtd->priv = chip assignment Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 53/58] mtd: nand: simplify nand_dt_init() usage Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 54/58] mtd: nand: kill the chip->flash_node field Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 55/58] mtd: nand: add helpers to access ->priv Boris Brezillon
     [not found]     ` <1449734442-18672-56-git-send-email-boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2015-12-18 22:17       ` Brian Norris
2015-12-10  8:00   ` [PATCH v4 56/58] ARM: make use of nand_set/get_controller_data() helpers Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 57/58] mtd: nand: " Boris Brezillon
2015-12-10  8:00   ` [PATCH v4 58/58] staging: mt29f_spinand: " Boris Brezillon
2015-12-18 22:03   ` [PATCH v4 00/58] mtd: nand: refactor the NAND subsystem (part 1) Brian Norris

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=20151211180855.47c95df2@bbrezillon \
    --to=boris.brezillon-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
    --cc=alex-L4GPcECwBoDe9xe1eoZjHA@public.gmane.org \
    --cc=alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
    --cc=andrew-g2DYL2Zd6BY@public.gmane.org \
    --cc=computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=corbet-T1hC0tSOHrs@public.gmane.org \
    --cc=devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b@public.gmane.org \
    --cc=dinh.linux-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=ezequiel.garcia-wi1+55ScJUtKEb57/3fJTGGXanvQGlWp@public.gmane.org \
    --cc=jesper.nilsson-VrBV9hrLPhE@public.gmane.org \
    --cc=k.kozlowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=kgene-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=marek.vasut-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=maximlevitsky-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org \
    --cc=robert.jarzmik-GANU6spQydw@public.gmane.org \
    --cc=stefan-XLVq0VzYD2Y@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    --cc=wens-jdAy2FN1RRM@public.gmane.org \
    /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).