All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Mason Yang <masonccyang@mxic.com.tw>, Vignesh R <vigneshr@ti.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	Julien Su <juliensu@mxic.com.tw>,
	Richard Weinberger <richard@nod.at>,
	Tudor Ambarus <Tudor.Ambarus@microchip.com>,
	Schrempf Frieder <frieder.schrempf@kontron.de>,
	Marek Vasut <marek.vasut@gmail.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 14/15] mtd: rawnand: Get rid of chip->numchips
Date: Tue, 21 May 2019 09:56:46 +0200	[thread overview]
Message-ID: <20190521075646.2qhwtsgn54tev6jn@pengutronix.de> (raw)
In-Reply-To: <20190521093302.079f5470@collabora.com>

On Tue, May 21, 2019 at 09:33:02AM +0200, Boris Brezillon wrote:
> On Tue, 21 May 2019 08:59:48 +0200
> Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> > Hi,
> > 
> > On Mon, Mar 04, 2019 at 09:15:21PM +0100, Miquel Raynal wrote:
> > > diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h
> > > index fbf6ca015cd7..a204f9d7e123 100644
> > > --- a/drivers/mtd/nand/raw/internals.h
> > > +++ b/drivers/mtd/nand/raw/internals.h
> > > @@ -110,7 +110,7 @@ static inline int nand_exec_op(struct nand_chip *chip,
> > >  	if (!nand_has_exec_op(chip))
> > >  		return -ENOTSUPP;
> > >  
> > > -	if (WARN_ON(op->cs >= chip->numchips))
> > > +	if (WARN_ON(op->cs >= nanddev_ntargets(&chip->base)))
> > >  		return -EINVAL;  
> > 
> > This warning triggers when I apply my gpmi nand exec_op series.
> > 
> > The gpmi driver calls:
> > 
> > 	ret = nand_scan(chip, GPMI_IS_MX6(this) ? 2 : 1);
> > 
> > This ends up in nand_scan_ident() with maxchips = 2. Here nand_detect()
> > is called which sets memorg->ntargets = 1; Later in nand_scan_ident() we
> > have:
> > 
> > 	for (i = 1; i < maxchips; i++) {
> 
> This loop should be fixed to test against nanddev_ntargets() instead of
> maxchips.

This makes the maxchips argument to nand_scan() unused. A lot of drivers
are calling nand_scan() with maxchips > 1. How are these working then?

Or should there be a memorg->ntargets = maxchips before the loop?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

WARNING: multiple messages have this Message-ID (diff)
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Boris Brezillon <boris.brezillon@collabora.com>
Cc: Mason Yang <masonccyang@mxic.com.tw>, Vignesh R <vigneshr@ti.com>,
	Boris Brezillon <bbrezillon@kernel.org>,
	Julien Su <juliensu@mxic.com.tw>,
	Richard Weinberger <richard@nod.at>,
	Tudor Ambarus <Tudor.Ambarus@microchip.com>,
	Schrempf Frieder <frieder.schrempf@kontron.de>,
	Marek Vasut <marek.vasut@gmail.com>,
	Masahiro Yamada <yamada.masahiro@socionext.com>,
	linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 14/15] mtd: rawnand: Get rid of chip->numchips
Date: Tue, 21 May 2019 09:56:46 +0200	[thread overview]
Message-ID: <20190521075646.2qhwtsgn54tev6jn@pengutronix.de> (raw)
In-Reply-To: <20190521093302.079f5470@collabora.com>

On Tue, May 21, 2019 at 09:33:02AM +0200, Boris Brezillon wrote:
> On Tue, 21 May 2019 08:59:48 +0200
> Sascha Hauer <s.hauer@pengutronix.de> wrote:
> 
> > Hi,
> > 
> > On Mon, Mar 04, 2019 at 09:15:21PM +0100, Miquel Raynal wrote:
> > > diff --git a/drivers/mtd/nand/raw/internals.h b/drivers/mtd/nand/raw/internals.h
> > > index fbf6ca015cd7..a204f9d7e123 100644
> > > --- a/drivers/mtd/nand/raw/internals.h
> > > +++ b/drivers/mtd/nand/raw/internals.h
> > > @@ -110,7 +110,7 @@ static inline int nand_exec_op(struct nand_chip *chip,
> > >  	if (!nand_has_exec_op(chip))
> > >  		return -ENOTSUPP;
> > >  
> > > -	if (WARN_ON(op->cs >= chip->numchips))
> > > +	if (WARN_ON(op->cs >= nanddev_ntargets(&chip->base)))
> > >  		return -EINVAL;  
> > 
> > This warning triggers when I apply my gpmi nand exec_op series.
> > 
> > The gpmi driver calls:
> > 
> > 	ret = nand_scan(chip, GPMI_IS_MX6(this) ? 2 : 1);
> > 
> > This ends up in nand_scan_ident() with maxchips = 2. Here nand_detect()
> > is called which sets memorg->ntargets = 1; Later in nand_scan_ident() we
> > have:
> > 
> > 	for (i = 1; i < maxchips; i++) {
> 
> This loop should be fixed to test against nanddev_ntargets() instead of
> maxchips.

This makes the maxchips argument to nand_scan() unused. A lot of drivers
are calling nand_scan() with maxchips > 1. How are these working then?

Or should there be a memorg->ntargets = maxchips before the loop?

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-05-21  7:57 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 20:15 [PATCH v2 00/15] mtd: rawnand: 5th batch of cleanups Miquel Raynal
2019-03-04 20:15 ` Miquel Raynal
2019-03-04 20:15 ` [PATCH v2 01/15] mtd: nand: Add max_bad_eraseblocks_per_lun info to memorg Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-06-04  8:01   ` Emil Lenngren
2019-06-04  8:01     ` Emil Lenngren
2019-06-06  8:27     ` Schrempf Frieder
2019-06-06  8:27       ` Schrempf Frieder
2019-06-06  8:39       ` Boris Brezillon
2019-06-06  8:39         ` Boris Brezillon
2019-06-06  8:52         ` Schrempf Frieder
2019-06-06  8:52           ` Schrempf Frieder
2019-06-06  8:57           ` Schrempf Frieder
2019-06-06  8:57             ` Schrempf Frieder
2019-06-06  9:05             ` Boris Brezillon
2019-06-06  9:05               ` Boris Brezillon
2019-06-06 13:06       ` Emil Lenngren
2019-06-06 13:06         ` Emil Lenngren
2019-03-04 20:15 ` [PATCH v2 02/15] mtd: nand: Add a helper returning the number of eraseblocks per target Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-04 20:15 ` [PATCH v2 03/15] mtd: nand: Add a helper to retrieve the number of pages " Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-04 20:15 ` [PATCH v2 04/15] mtd: spinand: Implement mtd->_max_bad_blocks Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-04 20:15 ` [PATCH v2 05/15] mtd: rawnand: Use nand_to_mtd() in nand_{set, get}_flash_node() Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-04 20:15 ` [PATCH v2 06/15] mtd: rawnand: Prepare things to reuse the generic NAND layer Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-04 20:15 ` [PATCH v2 07/15] mtd: rawnand: Fill memorg during detection Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-21  9:03   ` Schrempf Frieder
2019-03-21  9:03     ` Schrempf Frieder
2019-03-04 20:15 ` [PATCH v2 08/15] mtd: rawnand: Initialize the nand_device object Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-04 20:15 ` [PATCH v2 09/15] mtd: rawnand: Provide a helper to get chip->data_buf Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-04 20:15 ` [PATCH v2 10/15] mtd: rawnand: Move all page cache related fields to a sub-struct Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-04 20:15 ` [PATCH v2 11/15] mtd: rawnand: Use nanddev_mtd_max_bad_blocks() Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-04 20:15 ` [PATCH v2 12/15] mtd: rawnand: Get rid of chip->bits_per_cell Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-04 20:15 ` [PATCH v2 13/15] mtd: rawnand: Get rid of chip->chipsize Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-03-21  9:03   ` Schrempf Frieder
2019-03-21  9:03     ` Schrempf Frieder
2019-03-04 20:15 ` [PATCH v2 14/15] mtd: rawnand: Get rid of chip->numchips Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-05-21  6:59   ` Sascha Hauer
2019-05-21  6:59     ` Sascha Hauer
2019-05-21  7:33     ` Boris Brezillon
2019-05-21  7:33       ` Boris Brezillon
2019-05-21  7:43       ` Boris Brezillon
2019-05-21  7:43         ` Boris Brezillon
2019-05-21  7:51       ` Boris Brezillon
2019-05-21  7:51         ` Boris Brezillon
2019-05-21  7:58         ` Sascha Hauer
2019-05-21  7:58           ` Sascha Hauer
2019-05-21  8:01           ` Boris Brezillon
2019-05-21  8:01             ` Boris Brezillon
2019-05-21  7:56       ` Sascha Hauer [this message]
2019-05-21  7:56         ` Sascha Hauer
2019-03-04 20:15 ` [PATCH v2 15/15] mtd: rawnand: Get rid of chip->ecc_{strength, step}_ds Miquel Raynal
2019-03-04 20:15   ` Miquel Raynal
2019-04-01 15:28 ` [PATCH v2 00/15] mtd: rawnand: 5th batch of cleanups Miquel Raynal
2019-04-01 15:28   ` Miquel Raynal

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=20190521075646.2qhwtsgn54tev6jn@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=Tudor.Ambarus@microchip.com \
    --cc=bbrezillon@kernel.org \
    --cc=boris.brezillon@collabora.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=frieder.schrempf@kontron.de \
    --cc=juliensu@mxic.com.tw \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=masonccyang@mxic.com.tw \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vigneshr@ti.com \
    --cc=yamada.masahiro@socionext.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.