[PATCH] MTD: fix dataflash 64-bit divisions

Artem Bityutskiy dedekind at infradead.org
Thu Dec 18 01:20:07 EST 2008


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 (Битюцкий Артём)




More information about the linux-mtd mailing list