public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind@infradead.org>
To: Nicolas Pitre <nico@cam.org>
Cc: David Brownell <david-b@pacbell.net>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH] MTD: fix dataflash 64-bit divisions
Date: Thu, 18 Dec 2008 08:20:07 +0200	[thread overview]
Message-ID: <1229581207.17960.55.camel@sauron> (raw)
In-Reply-To: <alpine.LFD.2.00.0812171205290.30035@xanadu.home>

On Wed, 2008-12-17 at 12:15 -0500, Nicolas Pitre wrote:
> > -		pageaddr = instr->addr / priv->page_size;
> > +		tmp = instr->len;
> > +		do_div(tmp, priv->page_size);
> > +		pageaddr = tmp;
> 
> Here I suggest you include <linux/math64.h> and use this instead:
> 
> 	pageaddr = div_u64(instr->addr, priv->page_size);

Indeed, these div_u64()/div_u64_rem() functions seem to be nicer. Never
used them before.

-- 
Best regards,
Artem Bityutskiy (Битюцкий Артём)

  parent reply	other threads:[~2008-12-18  6:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-17 16:50 [PATCH] MTD: fix dataflash 64-bit divisions Artem Bityutskiy
2008-12-17 17:15 ` Nicolas Pitre
2008-12-17 17:47   ` David Brownell
2008-12-18  6:20   ` Artem Bityutskiy [this message]
2008-12-17 17:56 ` David Brownell
2008-12-18  6:26   ` Artem Bityutskiy
2008-12-18  6:59     ` David Brownell

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=1229581207.17960.55.camel@sauron \
    --to=dedekind@infradead.org \
    --cc=david-b@pacbell.net \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=nico@cam.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