Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1524112 > unrolled thread
| Started by | Peter Pan <peterpansjtu@gmail.com> |
|---|---|
| First post | 2016-11-17 07:20 +0100 |
| Last post | 2016-11-17 09:00 +0100 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v2 3/7] mtd: nand: add a nand.h file to expose basic NAND stuff Peter Pan <peterpansjtu@gmail.com> - 2016-11-17 07:20 +0100
Re: [PATCH v2 3/7] mtd: nand: add a nand.h file to expose basic NAND stuff Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-11-17 09:00 +0100
| From | Peter Pan <peterpansjtu@gmail.com> |
|---|---|
| Date | 2016-11-17 07:20 +0100 |
| Subject | Re: [PATCH v2 3/7] mtd: nand: add a nand.h file to expose basic NAND stuff |
| Message-ID | <sEodb-5pp-3@gated-at.bofh.it> |
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.
Thanks,
Peter Pan
[toc] | [next] | [standalone]
| From | Boris Brezillon <boris.brezillon@free-electrons.com> |
|---|---|
| Date | 2016-11-17 09:00 +0100 |
| Subject | Re: [PATCH v2 3/7] mtd: nand: add a nand.h file to expose basic NAND stuff |
| Message-ID | <sEpLY-69J-13@gated-at.bofh.it> |
| In reply to | #1524112 |
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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web