[PATCH 1/4] mtd: fix erasesize math for non power-of-2 devices

Robert Jarzmik robert.jarzmik at free.fr
Tue Sep 3 14:04:56 EDT 2013


Darren Garnier <dgarnier at reinrag.net> writes:

> Signed-off-by: Darren Garnier <dgarnier at reinrag.net>

Hi Darren,

First of all, do any device exist where erasesize is non power-of-2, and if so
which one do you have in mind ?

Secondly, if such devices exist, I'd wish to have that explained in the commit
message, to know what motivated your patch.

> +#define ALIGNED_OFFSET(offset, bs) ((bs & (bs-1)) == 0) ? \
> +									offset & ~(bs-1) : \
> +									bs * div_u64(offset,bs)
> +#define ALIGNED_COUNT(count, bs) ((bs & (bs-1)) == 0) ? \
> +									ALIGN(count,bs) : \
> +									bs *
> div_u64(count+(bs-1),bs)
These lines look a bit over 80 caracters to me, or is it my editor ...
Moreover the (bs & (bs-1)) == 0 should be replaced by IS_ALIGNED(bs).

Cheers.

--
Robert



More information about the barebox mailing list