linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Peter Pan <peterpansjtu@gmail.com>
Cc: Richard Weinberger <richard@nod.at>,
	linux-mtd@lists.infradead.org,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
	linux-kernel@vger.kernel.org,
	"peterpandong@micron.com" <peterpandong@micron.com>
Subject: Re: [PATCH v2 3/7] mtd: nand: add a nand.h file to expose basic NAND stuff
Date: Thu, 17 Nov 2016 08:52:16 +0100	[thread overview]
Message-ID: <20161117085216.14c17813@bbrezillon> (raw)
In-Reply-To: <CAAyFORLqjZTZ78XOdJbqUXvSFtsWmbtw_wpmjvBwu2Z4cYCvdQ@mail.gmail.com>

On Thu, 17 Nov 2016 14:14:21 +0800
Peter Pan <peterpansjtu@gmail.com> wrote:

> Hi Boris,
> 
> On Sun, Oct 16, 2016 at 10:35 PM, Boris Brezillon
> <boris.brezillon@free-electrons.com> wrote:
> > Now that raw NAND header has been moved to rawnand.h, we can add a new
> > nand.h file and define the common nand stuff in there.
> >
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > ---
> >  include/linux/mtd/nand.h | 480 +++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 480 insertions(+)
> >  create mode 100644 include/linux/mtd/nand.h
> >
> > diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
> > new file mode 100644
> > index 000000000000..b9b5d3c1bdf9
> > --- /dev/null
> > +++ b/include/linux/mtd/nand.h  
> [...]
> > +
> > +/**
> > + * nand_offs_to_die - Convert an absolute offset to a die number
> > + * @nand: NAND device
> > + * @offs: absolute offset
> > + *
> > + * Returns the die number containing @offs.
> > + */
> > +static inline int nand_offs_to_die(struct nand_device *nand, loff_t offs)
> > +{
> > +       u64 die = offs;
> > +
> > +       do_div(die, nand->memorg.diesize);
> > +
> > +       return die;  
> 
> Is it proper to use do_div here?. If I'm right, the divisor of do_div is 32bit.
> It may cause division 0 exception when die size is larger than 4GB.
> div64_u64 may be better.

Nice catch! Indeed, div64_u64() should be used here. I'll fix that.

Thanks,

Boris

  reply	other threads:[~2016-11-17  7:52 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-16 14:35 [PATCH v2 0/7] mtd: nand: Abstract away the NAND interface type Boris Brezillon
2016-10-16 14:35 ` [PATCH v2 1/7] mtd: nand: Rename nand.h into rawnand.h Boris Brezillon
2016-10-16 14:35 ` [PATCH v2 2/7] mtd: nand: move raw NAND related code to the raw/ subdir Boris Brezillon
2016-10-16 14:35 ` [PATCH v2 3/7] mtd: nand: add a nand.h file to expose basic NAND stuff Boris Brezillon
2016-11-17  6:14   ` Peter Pan
2016-11-17  7:52     ` Boris Brezillon [this message]
2016-10-16 14:35 ` [PATCH v2 4/7] mtd: nand: raw: prefix conflicting names with nandc instead of nand Boris Brezillon
2016-10-16 14:35 ` [PATCH v2 5/7] mtd: nand: raw: create struct rawnand_device Boris Brezillon
2016-10-16 14:35 ` [PATCH v2 6/7] mtd: nand: raw: make BBT code more generic Boris Brezillon
2016-11-16  8:43   ` Peter Pan
2016-11-16  8:46     ` Boris Brezillon
2016-11-17  6:19   ` Peter Pan
2016-11-17  7:51     ` Boris Brezillon
2016-10-16 14:35 ` [PATCH v2 7/7] mtd: nand: move BBT code to drivers/mtd/nand/ Boris Brezillon
2016-11-17  6:26 ` [PATCH v2 0/7] mtd: nand: Abstract away the NAND interface type Peter Pan
2016-11-17  7:56   ` Boris Brezillon
2016-11-17  8:08     ` Peter Pan

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=20161117085216.14c17813@bbrezillon \
    --to=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=peterpandong@micron.com \
    --cc=peterpansjtu@gmail.com \
    --cc=richard@nod.at \
    /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).